![](/img/trans.png)
[英]Django queryset get all fields in values() plus a foreign key field
[英]django resource get all fields ( manytomany,foreign key etc.)
从我的问题中可以看出,我想从 users 表中下载所有其他相关表中的数据。
class UserResource(resources.ModelResource):
class Meta:
model = User
fields = ['__all__'] # But I want ALL FIELDS ( foreign key fields etc.)
我认为fields = '__all__'
,而不是fields = ['__all__']
。 而当你想添加额外的字段时,你可以设置extra_fields
属性。
...
fields = '__all__'
extra_fields = ['extra']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.