1class VariableSerializer(serializers.ModelSerializer):
2 owner_name = serializers.Field(source='owner_id.owner_name')
3
4 class Meta:
5 model = Varmst
6 resource_name = 'varmst'
7 fields = ('varmst_id', 'varmst_type', 'varmst_name', 'varmst_value',
8 'varmst_desc')
9
10 def transform_varmst_type(self, obj, value):
11 if obj.varmst_value == 2:
12 return "email"
13 if obj.varmst_value == 3:
14 return "Website"
15