mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Merge pull request #621 from mktums/patch-1
Update docs/tutorial/1-serialization.md
This commit is contained in:
commit
fdd35cd266
|
@ -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.
|
Create or update a new snippet instance.
|
||||||
"""
|
"""
|
||||||
if instance:
|
if instance:
|
||||||
# Update existing instance
|
# Update existing instance or part of it
|
||||||
instance.title = attrs['title']
|
instance.title = attrs.get('title', instance.title)
|
||||||
instance.code = attrs['code']
|
instance.code = attrs.get('code', instance.code)
|
||||||
instance.linenos = attrs['linenos']
|
instance.linenos = attrs.get('linenos', instance.linenos)
|
||||||
instance.language = attrs['language']
|
instance.language = attrs.get('language', instance.language)
|
||||||
instance.style = attrs['style']
|
instance.style = attrs.get('style', instance.style)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
# Create new instance
|
# Create new instance
|
||||||
|
|
Loading…
Reference in New Issue
Block a user