我在使用tastype并试图使ToManyField正常工作时遇到此错误(它不应返回任何null值):
error: "The model 'Feature: Feature object' has an empty attribute 'featureloc_set' and doesn't allow a null value."
以下是模型:
^{pr2}$这些是资源:
class BFeatureResource(ModelResource):
featurelocs = fields.ToManyField('api.BFeaturelocResource2', 'featureloc_set', full=True)
class Meta:
resource_name = 'bands'
queryset = Feature.objects.all()
class BFeaturelocResource2(ModelResource):
feature = fields.ForeignKey(BFeatureResource, 'feature')
class Meta:
resource_name = 'featurelocs'
queryset = Featureloc.objects.all()
Featureloc-to-Feature中有两个ForeingKey字段(即Feature和srcfeature)是否混淆?我错了什么?在
现在,通过在ForeignKey上使用与ToManyField中的属性相匹配的相关的_名称来执行此操作:
以及
^{pr2}$相关问题 更多 >
编程相关推荐