diff options
| author | Tom Christie | 2014-12-05 12:46:08 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-05 12:46:08 +0000 |
| commit | 1b8c06aefe33f178610d2c4195a72637757698e8 (patch) | |
| tree | 244a452750bd1f89cee741e0713db8372d967bdf | |
| parent | e2b39088345e564a06ce332b740215600c29e481 (diff) | |
| download | django-rest-framework-1b8c06aefe33f178610d2c4195a72637757698e8.tar.bz2 | |
Style tweaks in examples
| -rw-r--r-- | docs/tutorial/1-serialization.md | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index eb0a00c0..fc1b87f9 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -16,7 +16,6 @@ The tutorial is fairly in-depth, so you should probably get a cookie and a cup o Before we do anything else we'll create a new virtual environment, using [virtualenv]. This will make sure our package configuration is kept nicely isolated from any other projects we're working on. - :::bash virtualenv env source env/bin/activate @@ -75,12 +74,8 @@ For the purposes of this tutorial we're going to start by creating a simple `Sni title = models.CharField(max_length=100, blank=True, default='') code = models.TextField() linenos = models.BooleanField(default=False) - language = models.CharField(choices=LANGUAGE_CHOICES, - default='python', - max_length=100) - style = models.CharField(choices=STYLE_CHOICES, - default='friendly', - max_length=100) + language = models.CharField(choices=LANGUAGE_CHOICES, default='python', max_length=100) + style = models.CharField(choices=STYLE_CHOICES, default='friendly', max_length=100) class Meta: ordering = ('created',) @@ -101,14 +96,11 @@ The first thing we need to get started on our Web API is to provide a way of ser class SnippetSerializer(serializers.Serializer): pk = serializers.IntegerField(read_only=True) - title = serializers.CharField(required=False, allow_blank=True - max_length=100) + title = serializers.CharField(required=False, allow_blank=True, max_length=100) code = serializers.CharField(style={'type': 'textarea'}) linenos = serializers.BooleanField(required=False) - language = serializers.ChoiceField(choices=LANGUAGE_CHOICES, - default='python') - style = serializers.ChoiceField(choices=STYLE_CHOICES, - default='friendly') + language = serializers.ChoiceField(choices=LANGUAGE_CHOICES, default='python') + style = serializers.ChoiceField(choices=STYLE_CHOICES, default='friendly') def create(self, validated_data): """ |
