changes in device assignment - incentive plan structure in quota serializer
This commit is contained in:
@@ -106,8 +106,8 @@ class QuotaIncentiveAssignmentSerializer(serializers.ModelSerializer):
|
||||
"id",
|
||||
"quota",
|
||||
"incentive_plan",
|
||||
"heavy_value",
|
||||
"light_value",
|
||||
"livestock_type",
|
||||
"quantity_kg",
|
||||
]
|
||||
|
||||
def to_representation(self, instance):
|
||||
@@ -115,6 +115,11 @@ class QuotaIncentiveAssignmentSerializer(serializers.ModelSerializer):
|
||||
|
||||
representation = super().to_representation(instance)
|
||||
representation['incentive_plan_name'] = instance.incentive_plan.name
|
||||
if instance.livestock_type:
|
||||
representation['livestock_type'] = {
|
||||
'name': instance.livestock_type.name,
|
||||
'id': instance.livestock_type.id
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user