我正在 admin.py 中进行导入导出到 excel,每次单击导入按钮时,我都会收到此错误“CustomerPurchaseOrder”对象没有属性“get_user_visible_fields”我不知道我的代码出了什么问题,我一直在遵循文档(以下)。我的代码中遗漏了什么吗?
class CustomerPurchaseOrderResource(resources.ModelResource):
class Meta:
model = CustomerPurchaseOrder
fields = ('profile', 'customer_Purchase_Order_Detail', 'process', 'deliverySchedule', 'deliveryDate', 'paymentmethod',
'requestedDate',)
class CustomerPurchaseOrderAdmin(ImportExportModelAdmin):
list_filter = ("process", "deliverySchedule", "inputdate")
list_display = (
'profile', 'customer_Purchase_Order_Detail', 'process', 'deliverySchedule', 'deliveryDate', 'paymentmethod',
'requestedDate',)
ordering = ('id','requestedDate')
resource_class = CustomerPurchaseOrder
这是我的 models.py
class CustomerPurchaseOrder(models.Model):
profile = models.ForeignKey(Customer,
on_delete=models.SET_NULL, null=True, blank=True,
verbose_name="Client Account")
customerdeliveryaddress = models.ForeignKey(CustomerDeliveryAddress,
on_delete=models.SET_NULL, null=True, blank=True,
verbose_name="Delivery Address")
customer_Purchase_Order_Detail = models.ForeignKey('CustomerPurchaseOrderDetail',
on_delete=models.SET_NULL, null=True, blank=True,
verbose_name="Customer Purchase Order")
process = models.ForeignKey('Process',
on_delete=models.SET_NULL, null=True, blank=True,
verbose_name="Process")
海绵宝宝撒
相关分类