Created
May 16, 2017 00:42
-
-
Save KTruong008/f8ea0809d25d27be14163d489dd0076e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HandSerializer(serializers.HyperlinkedModelSerializer): | |
user = serializers.CharField(read_only=True, source=’user.username’) | |
deck = serializers.CharField(read_only=True, required=False, source=’deck.name’) | |
cards = CardSerializer(many=True, read_only=True) | |
class Meta: | |
model = Hand | |
fields = (‘url’, ‘id’, ‘created’, | |
‘deck’, ‘name’, ‘user’, ‘cards’) | |
extra_kwargs = { | |
‘url’: { | |
‘view_name’: ‘goals:hand-detail’, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment