1
这是我的用户资源类过滤器用户通过用户组中tastypie
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
allowed_methods = ['get', 'post', 'put', 'patch']
resource_name = 'user'
excludes = ['password']
#authentication = SessionAuthentication()
#authorization = DjangoAuthorization()
authorization = Authorization()
authentication = Authentication()
always_return_data = True
filtering = {
'id': ALL,
'username': ALL,
'groups': ALL_WITH_RELATIONS
}
我想通过自己的组名来过滤用户。 Like/api/v1/user /?format = json & groups__name = group_name
上述格式不起作用。我如何在获取请求中过滤它?