Created
August 22, 2014 16:55
-
-
Save igr-santos/a4eb354b859c21d10f1f to your computer and use it in GitHub Desktop.
example use Django Rest Framework
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
# serializers.py | |
class ObjectiveSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Objective | |
fields = ( | |
'name', 'short_description', 'points_awarded', | |
'number_of_steps', 'energy_cost' | |
) | |
# views.py | |
class ObjectiveListAPI(generics.ListAPIView): | |
queryset = Objective.objects.all() | |
serializer_class = ObjectiveSerializer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment