2
我有这个作为我的资源tastypie - 如何过滤通用外键?
class AResource(ModelResource):
content_object = GenericForeignKeyField({
B: BResource,
}, 'content_object')
class Meta:
queryset = A.objects.all()
filtering = {
'content_type': ????,
}
我想通过资源BResource的ID进行过滤,这种资源。
我试图通过这个网址进行过滤:
http://domain.com/api/v1/a/?content_type=/api/v1/b/7/
和http://domain.com/api/v1/a/?content_object=/api/v1/b/7/
,但没有奏效。
我们该如何过滤?