fix - bug of quota with org context in distribution serializer
This commit is contained in:
@@ -124,8 +124,13 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
|||||||
many=True
|
many=True
|
||||||
).data
|
).data
|
||||||
|
|
||||||
|
quota_serializer = QuotaSerializer(
|
||||||
|
quota,
|
||||||
|
context={'org': self.context['org']}
|
||||||
|
).data if 'org' in self.context.keys() else QuotaSerializer(quota).data
|
||||||
|
|
||||||
if quota:
|
if quota:
|
||||||
representation['quota'] = QuotaSerializer(quota).data
|
representation['quota'] = quota_serializer
|
||||||
|
|
||||||
if assigned_org:
|
if assigned_org:
|
||||||
representation['assigned_organization'] = {
|
representation['assigned_organization'] = {
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, DynamicS
|
|||||||
)
|
)
|
||||||
if page is not None:
|
if page is not None:
|
||||||
serializer = quota_distribution_serializers.QuotaDistributionSerializer(
|
serializer = quota_distribution_serializers.QuotaDistributionSerializer(
|
||||||
page, many=True
|
page, many=True, context={'org': my_org}
|
||||||
)
|
)
|
||||||
return self.get_paginated_response(serializer.data)
|
return self.get_paginated_response(serializer.data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user