This commit is contained in:
Eric Theise 2015-01-19 22:03:08 +00:00
commit f94d1cf5a5

View File

@ -571,7 +571,7 @@ Open the file <code>snippets/serializers.py</code> again, and edit the <code>Sni
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>&gt;&gt;&gt; from snippets.serializers import SnippetSerializer
&gt;&gt;&gt; serializer = SnippetSerializer()
&gt;&gt;&gt; print(repr(serializer))