fix - bug of quota with org context in distribution serializer

This commit is contained in:
2025-12-02 16:51:39 +03:30
parent 22335877ab
commit 0cc719e84b
2 changed files with 7 additions and 2 deletions

View File

@@ -124,8 +124,13 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
many=True
).data
quota_serializer = QuotaSerializer(
quota,
context={'org': self.context['org']}
).data if 'org' in self.context.keys() else QuotaSerializer(quota).data
if quota:
representation['quota'] = QuotaSerializer(quota).data
representation['quota'] = quota_serializer
if assigned_org:
representation['assigned_organization'] = {

View File

@@ -459,7 +459,7 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, DynamicS
)
if page is not None:
serializer = quota_distribution_serializers.QuotaDistributionSerializer(
page, many=True
page, many=True, context={'org': my_org}
)
return self.get_paginated_response(serializer.data)
except Exception as e: