list of rancher plans api by rancher id - complete

This commit is contained in:
2025-09-27 16:22:28 +03:30
parent f6f8f4c669
commit 973d1319da
2 changed files with 31 additions and 2 deletions

View File

@@ -179,3 +179,13 @@ class IncentivePlanRancherSerializer(serializers.ModelSerializer):
raise exceptions.RancherIncentivePlanExists()
return attrs
def to_representation(self, instance: product_models.IncentivePlanRancher):
representations = super().to_representation(instance)
representations['plan_name'] = instance.plan.name
representations['rancher_id'] = instance.rancher.id
representations['livestock_type_name'] = instance.livestock_type.name
representations['allowed_quantity'] = instance.allowed_quantity
return representations