Skip to content

Commit 2d7d3b7

Browse files
committed
Make code block consistent in serialization tutorial
All the other code blocks in the Serialization tutorial can be copied and pasted, but there is one that includes the >>> shell prompt characters. This commit removes those characters, and also makes the output consistent with other code blocks by making it a comment.
1 parent dafbe65 commit 2d7d3b7

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)