Skip to content

Commit

Permalink
Fix N+1
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikhorluck committed Mar 24, 2024
1 parent ed2cf86 commit 46484ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/authentication/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class OnlineGroupViewSet(MultiSerializerMixin, viewsets.ModelViewSet):
@action(detail=True, methods=["get"], url_path="group-users")
def group_users(self, request, pk: int = None):
group: OnlineGroup = self.get_object()
users = group.members.all()
users = group.members.select_related("user").prefetch_related("roles")
serializer = self.get_serializer(users, many=True)
return Response(data=serializer.data, status=status.HTTP_200_OK)

Expand Down

0 comments on commit 46484ac

Please sign in to comment.