UserResource Tastypie modelResource で「auth_user_groups」テーブルを公開する方法があるかどうかを調べるのに苦労しています。
グループとユーザーを取得できますが、UserResource 内でユーザーが割り当てられているグループを表示する方法がわかりません。私が持っているModelResourcesは次のとおりです。
class GroupResource(ModelResource):
class Meta:
queryset = Group.objects.all()
always_return_data = True
resource_name = 'groups'
detail_allowed_methods = ['get']
list_allowed_methods = ['get']
filtering = {
'username': ALL,
}
authentication = ApiKeyAuthentication()
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
always_return_data = True
resource_name = 'user'
excludes = ['is_active', 'is_staff', 'is_superuser']
authorization = UserAuthorization()
detail_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']
list_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']
filtering = {
'username': ALL,
}
authentication = ApiKeyAuthentication()
ご協力いただきありがとうございます。