livestock type in age limitations

This commit is contained in:
2025-07-14 14:12:34 +03:30
parent 5f7dfb0ec5
commit a70d451ca1

View File

@@ -149,6 +149,17 @@ class QuotaLiveStockAgeLimitationSerializer(serializers.ModelSerializer):
model = product_models.QuotaLiveStockAgeLimitation
fields = '__all__'
def to_representation(self, instance):
""" custom output for livestock type """
representation = super().to_representation(instance)
if isinstance(instance, product_models.QuotaLiveStockAgeLimitation):
representation['livestock_type'] = LiveStockTypeSerializer(
instance.livestock_type
).data
return representation
def update(self, instance, validated_data):
""" Custom Update """