Skip to content

Commit 060444d

Browse files
committed
Merge pull request #3791 from craigglennie/patch-1
Make code block consistent in serialization tutorial
2 parents dafbe65 + 2d7d3b7 commit 060444d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/tutorial/1-serialization.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,16 @@ Open the file `snippets/serializers.py` again, and replace the `SnippetSerialize
193193

194194
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 `python manage.py shell`, then try the following:
195195

196-
>>> from snippets.serializers import SnippetSerializer
197-
>>> serializer = SnippetSerializer()
198-
>>> print(repr(serializer))
199-
SnippetSerializer():
200-
id = IntegerField(label='ID', read_only=True)
201-
title = CharField(allow_blank=True, max_length=100, required=False)
202-
code = CharField(style={'base_template': 'textarea.html'})
203-
linenos = BooleanField(required=False)
204-
language = ChoiceField(choices=[('Clipper', 'FoxPro'), ('Cucumber', 'Gherkin'), ('RobotFramework', 'RobotFramework'), ('abap', 'ABAP'), ('ada', 'Ada')...
205-
style = ChoiceField(choices=[('autumn', 'autumn'), ('borland', 'borland'), ('bw', 'bw'), ('colorful', 'colorful')...
196+
from snippets.serializers import SnippetSerializer
197+
serializer = SnippetSerializer()
198+
print(repr(serializer))
199+
# SnippetSerializer():
200+
# id = IntegerField(label='ID', read_only=True)
201+
# title = CharField(allow_blank=True, max_length=100, required=False)
202+
# code = CharField(style={'base_template': 'textarea.html'})
203+
# linenos = BooleanField(required=False)
204+
# language = ChoiceField(choices=[('Clipper', 'FoxPro'), ('Cucumber', 'Gherkin'), ('RobotFramework', 'RobotFramework'), ('abap', 'ABAP'), ('ada', 'Ada')...
205+
# style = ChoiceField(choices=[('autumn', 'autumn'), ('borland', 'borland'), ('bw', 'bw'), ('colorful', 'colorful')...
206206

207207
It's important to remember that `ModelSerializer` classes don't do anything particularly magical, they are simply a shortcut for creating serializer classes:
208208

0 commit comments

Comments
 (0)