(user) add organization data on users API

This will allow the frontend to display data about
organizations when displaying a user or a list of
users.
This commit is contained in:
Quentin BEY
2024-11-22 14:18:50 +01:00
committed by BEY Quentin
parent 5692c50f21
commit edbd1f0061
5 changed files with 119 additions and 14 deletions

View File

@@ -225,7 +225,9 @@ class UserViewSet(
"""
permission_classes = [permissions.IsSelf]
queryset = models.User.objects.all().order_by("-created_at")
queryset = (
models.User.objects.select_related("organization").all().order_by("-created_at")
)
serializer_class = serializers.UserSerializer
get_me_serializer_class = serializers.UserMeSerializer
throttle_classes = [BurstRateThrottle, SustainedRateThrottle]