livestock type in age limitations
This commit is contained in:
@@ -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 """
|
||||
|
||||
|
||||
Reference in New Issue
Block a user