🐛(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:
@@ -146,7 +146,7 @@ class ContactViewSet(
|
|||||||
"""Contact ViewSet"""
|
"""Contact ViewSet"""
|
||||||
|
|
||||||
permission_classes = [permissions.AccessPermission]
|
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
|
serializer_class = serializers.ContactSerializer
|
||||||
throttle_classes = [BurstRateThrottle, SustainedRateThrottle]
|
throttle_classes = [BurstRateThrottle, SustainedRateThrottle]
|
||||||
ordering_fields = ["full_name", "short_name", "created_at"]
|
ordering_fields = ["full_name", "short_name", "created_at"]
|
||||||
|
|||||||
Reference in New Issue
Block a user