Tweak imports in tutorial. Fixes #597.

This commit is contained in:
Tom Christie 2013-01-19 15:31:21 +00:00
parent a98049c5de
commit af3fd09845

View File

@ -109,7 +109,7 @@ The first thing we need to get started on our Web API is provide a way of serial
from django.forms import widgets
from rest_framework import serializers
from snippets import models
from snippets.models import Snippet
class SnippetSerializer(serializers.Serializer):
@ -138,7 +138,7 @@ The first thing we need to get started on our Web API is provide a way of serial
return instance
# Create new instance
return models.Snippet(**attrs)
return Snippet(**attrs)
The first part of serializer class defines the fields that get serialized/deserialized. The `restore_object` method defines how fully fledged instances get created when deserializing data.