diff options
| author | Craig de Stigter | 2013-05-18 10:23:26 +0200 |
|---|---|---|
| committer | Craig de Stigter | 2013-05-18 10:23:26 +0200 |
| commit | c56d5f8f63673e2d0235015e67d78f8e0e1d7550 (patch) | |
| tree | bf96abef843accae2439413de45095de2995f473 /docs/tutorial/1-serialization.md | |
| parent | 84be169353f0dd2ceb06fe459b72aa2452fcbeb5 (diff) | |
| parent | 34776da9249a5d73f822b3562bc56a5674b10ac7 (diff) | |
| download | django-rest-framework-c56d5f8f63673e2d0235015e67d78f8e0e1d7550.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'docs/tutorial/1-serialization.md')
| -rw-r--r-- | docs/tutorial/1-serialization.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 6709f751..ed54a876 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -126,7 +126,11 @@ The first thing we need to get started on our Web API is provide a way of serial def restore_object(self, attrs, instance=None): """ - Create or update a new snippet instance. + Create or update a new snippet instance, given a dictionary + of deserialized field values. + + Note that if we don't define this method, then deserializing + data will simply return a dictionary of items. """ if instance: # Update existing instance @@ -200,7 +204,7 @@ We can also serialize querysets instead of model instances. To do so we simply ## Using ModelSerializers -Our `SnippetSerializer` class is replicating a lot of information that's also contained in the `Snippet` model. It would be nice if we could keep out code a bit more concise. +Our `SnippetSerializer` class is replicating a lot of information that's also contained in the `Snippet` model. It would be nice if we could keep our code a bit more concise. In the same way that Django provides both `Form` classes and `ModelForm` classes, REST framework includes both `Serializer` classes, and `ModelSerializer` classes. |
