[英]django resource get all fields ( manytomany,foreign key etc.)
As you can see from my question, I want to download data from all other relevant tables from the users table.从我的问题中可以看出,我想从 users 表中下载所有其他相关表中的数据。
class UserResource(resources.ModelResource):
class Meta:
model = User
fields = ['__all__'] # But I want ALL FIELDS ( foreign key fields etc.)
I think fields = '__all__'
, not fields = ['__all__']
.我认为fields = '__all__'
,而不是fields = ['__all__']
。 And when you want to add the extra field, you can set the extra_fields
attribute.而当你想添加额外的字段时,你可以设置extra_fields
属性。
...
fields = '__all__'
extra_fields = ['extra']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.