【发布时间】:2014-03-26 16:33:15
【问题描述】:
这是资源
class TagResource(ModelResource):
user = tastypie.fields.ForeignKey(UserResource,'user')
class Meta:
queryset = Tag.objects.all()
resource_name = 'tag'
authorization= Authorization()
object_class = Tag
filtering = {
'name' : ALL,
}
简单的获取请求
http://localhost:8000/api/v1/tag/1/?format=json
返回空resource_uri
{"created": "2014-03-26T15:14:11.928068",
"id": 1, "name": "test",
"resource_uri": "", "user": ""}
这是为什么呢?
我试过了
def hydrate_resource_uri(self, bundle):
return bundle.get_resource_uri()
它不起作用,我很确定它不需要特别照顾。
我错过了什么?
【问题讨论】: