🐛(contacts) add missing select_related

The new DRF version (3.16.0) adds a check on unique together and needs
more fields to be loaded. To prevent an extra query, we select the owner
value in the DB query.
This commit is contained in:
Quentin BEY
2025-04-01 10:49:20 +02:00
committed by BEY Quentin
parent d0854851a2
commit 1eb9dffa48

View File

@@ -146,7 +146,7 @@ class ContactViewSet(
"""Contact ViewSet"""
permission_classes = [permissions.AccessPermission]
queryset = models.Contact.objects.select_related("user").all()
queryset = models.Contact.objects.select_related("user", "owner").all()
serializer_class = serializers.ContactSerializer
throttle_classes = [BurstRateThrottle, SustainedRateThrottle]
ordering_fields = ["full_name", "short_name", "created_at"]