Guest User

Untitled

a guest
Nov 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. class FriendGiftSerializer(ModelSerializer):
  2. giftDisplayData = AllGiftSerializer(source='giftId', required=True)
  3. bestMatch = serializers.IntegerField()
  4. topAttribute = serializers.SerializerMethodField()
  5.  
  6. class Meta:
  7. model = FriendGift
  8. fields = ('giftId', 'giftDisplayData', 'bestMatch', 'topAttribute')
  9.  
  10. def get_topAttribute(self, obj):
  11. return self.context["top_attribute"]
Add Comment
Please, Sign In to add comment