I have been struggling to find out if there is way to expose the 'auth_user_groups' table in my UserResource Tastypie modelResource.
I am able to get the Groups and Users, but not sure how to show the Groups that a User is assigned to within my UserResource. Here are the ModelResources I have:
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()
Thanks for your help.