mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 19:43:59 +03:00
Fix serializer restore_object example for partial updates
This commit is contained in:
parent
ef0caf64d3
commit
034c4ce408
|
@ -42,9 +42,9 @@ Declaring a serializer looks very similar to declaring a form:
|
|||
data will simply return a dictionary of items.
|
||||
"""
|
||||
if instance is not None:
|
||||
instance.title = attrs['title']
|
||||
instance.content = attrs['content']
|
||||
instance.created = attrs['created']
|
||||
instance.title = attrs.get('title', instance.title)
|
||||
instance.content = attrs.get('content', instance.content)
|
||||
instance.created = attrs.get('created', instance.created)
|
||||
return instance
|
||||
return Comment(**attrs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user