我对 Django & Tastypie 很陌生。我想只返回查询中的一个对象。我几乎尝试了所有方法,但似乎找不到解决方案。下面是我的代码:
class ProfileResource(ModelResource):
person = fields.ForeignKey(UserResource, 'user', full=True)
class Meta:
queryset = Person.objects.all()
resource_name = 'profile'
authentication = BasicAuthentication()
authorization = DjangoAuthorization()
serializer = Serializer(formats=['json'])
现在我遇到问题的部分是如何使用request.user
.