mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Merge 5e7663aa5a
into d8dbd86790
This commit is contained in:
commit
f94d1cf5a5
|
@ -571,7 +571,7 @@ Open the file <code>snippets/serializers.py</code> again, and edit the <code>Sni
|
||||||
model = Snippet
|
model = Snippet
|
||||||
fields = ('id', 'title', 'code', 'linenos', 'language', 'style')
|
fields = ('id', 'title', 'code', 'linenos', 'language', 'style')
|
||||||
</code></pre>
|
</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
|
<pre><code>>>> from snippets.serializers import SnippetSerializer
|
||||||
>>> serializer = SnippetSerializer()
|
>>> serializer = SnippetSerializer()
|
||||||
>>> print(repr(serializer))
|
>>> print(repr(serializer))
|
||||||
|
@ -778,4 +778,4 @@ HTTP/1.1 200 OK
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user