我最近更新了美味派,到处都开始出现问题。我曾经使用 0.11,最近更新到 0.16。每当我创建 Post 对象时,它都会重置外键对象的所有字段,在这种情况下是poster。下面是我的资源:
class UploadResource(ModelResource):
poster = fields.ForeignKey(PosterResource, 'poster', full=True)
class Meta:
queryset = Post.objects.all()
allowed_methods = ['post', 'get']
resource_name = 'upload'
authorization = Authorization()
authentication = BasicAuthentication()
include_resource_uri = False
always_return_data = True
UploadResource从我的前端接收以下 json:
{
"description":"My new Jacket",
"url_of_image":"http:\/\/pictures.post-app.com\/bob\/08-08-201312-10-4847373978242.jpg",
"address":"",
"location_id":"",
"lat":43.637,
"lon":-79.417,
"name_of_location":"",
"poster":{"user":{"id":"3"}}
}
创建此对象后,它会重置与海报关联的所有字段。它将所有这些字段更改为空白,这是为什么呢?