diff options
Diffstat (limited to 'tutorial/1-serialization/index.html')
| -rw-r--r-- | tutorial/1-serialization/index.html | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/tutorial/1-serialization/index.html b/tutorial/1-serialization/index.html index 2363f355..6782a94c 100644 --- a/tutorial/1-serialization/index.html +++ b/tutorial/1-serialization/index.html @@ -565,13 +565,13 @@ serializer.data  <p>Our <code>SnippetSerializer</code> class is replicating a lot of information that's also contained in the <code>Snippet</code> model.  It would be nice if we could keep our code a bit  more concise.</p>  <p>In the same way that Django provides both <code>Form</code> classes and <code>ModelForm</code> classes, REST framework includes both <code>Serializer</code> classes, and <code>ModelSerializer</code> classes.</p>  <p>Let's look at refactoring our serializer using the <code>ModelSerializer</code> class. -Open the file <code>snippets/serializers.py</code> again, and edit the <code>SnippetSerializer</code> class.</p> +Open the file <code>snippets/serializers.py</code> again, and replace the <code>SnippetSerializer</code> class with the following.</p>  <pre><code>class SnippetSerializer(serializers.ModelSerializer):      class Meta:          model = Snippet          fields = ('id', 'title', 'code', 'linenos', 'language', 'style')  </code></pre> -<p>One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing it's representation. Open the Django shell with <code>python manage.py shell</code>, then try the following:</p> +<p>One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing its representation. Open the Django shell with <code>python manage.py shell</code>, then try the following:</p>  <pre><code>>>> from snippets.serializers import SnippetSerializer  >>> serializer = SnippetSerializer()  >>> print(repr(serializer)) | 
