diff options
| author | Tom Christie | 2013-01-27 23:50:23 -0800 |
|---|---|---|
| committer | Tom Christie | 2013-01-27 23:50:23 -0800 |
| commit | fdd35cd2660f8e9d2a442b41c38ad53a6d457f5c (patch) | |
| tree | 88e3ee12d83e97e70d710d1cda2922acb3899187 /docs/tutorial | |
| parent | a58145e20f796232ef0143f28ecb0c31dbfea92e (diff) | |
| parent | c1dc1860da86dc119f2e80837c6b327af12b9b38 (diff) | |
| download | django-rest-framework-fdd35cd2660f8e9d2a442b41c38ad53a6d457f5c.tar.bz2 | |
Merge pull request #621 from mktums/patch-1
Update docs/tutorial/1-serialization.md
Diffstat (limited to 'docs/tutorial')
| -rw-r--r-- | docs/tutorial/1-serialization.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index f5ff167f..d66d2b97 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -129,12 +129,12 @@ The first thing we need to get started on our Web API is provide a way of serial Create or update a new snippet instance. """ if instance: - # Update existing instance - instance.title = attrs['title'] - instance.code = attrs['code'] - instance.linenos = attrs['linenos'] - instance.language = attrs['language'] - instance.style = attrs['style'] + # Update existing instance or part of it + instance.title = attrs.get('title', instance.title) + instance.code = attrs.get('code', instance.code) + instance.linenos = attrs.get('linenos', instance.linenos) + instance.language = attrs.get('language', instance.language) + instance.style = attrs.get('style', instance.style) return instance # Create new instance |
