Commit fdd35cd2 by Tom Christie

Merge pull request #621 from mktums/patch-1

Update docs/tutorial/1-serialization.md
parents a58145e2 c1dc1860
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment