mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-28 01:13:16 +03:00
Minor docs update. Refs #2375.
This commit is contained in:
parent
26ac2656e5
commit
d3b2302588
|
@ -87,12 +87,12 @@ The resulting API changes are further detailed below.
|
||||||
|
|
||||||
#### The `.create()` and `.update()` methods.
|
#### The `.create()` and `.update()` methods.
|
||||||
|
|
||||||
The `.restore_object()` method is now replaced with two separate methods, `.create()` and `.update()`.
|
The `.restore_object()` method is now removed, and we instead have two separate methods, `.create()` and `.update()`. These methods work slightly different to the previous `.restore_object()`.
|
||||||
|
|
||||||
These methods also replace the optional `.save_object()` method, which no longer exists.
|
|
||||||
|
|
||||||
When using the `.create()` and `.update()` methods you should both create *and save* the object instance. This is in contrast to the previous `.restore_object()` behavior that would instantiate the object but not save it.
|
When using the `.create()` and `.update()` methods you should both create *and save* the object instance. This is in contrast to the previous `.restore_object()` behavior that would instantiate the object but not save it.
|
||||||
|
|
||||||
|
These methods also replace the optional `.save_object()` method, which no longer exists.
|
||||||
|
|
||||||
The following example from the tutorial previously used `restore_object()` to handle both creating and updating object instances.
|
The following example from the tutorial previously used `restore_object()` to handle both creating and updating object instances.
|
||||||
|
|
||||||
def restore_object(self, attrs, instance=None):
|
def restore_object(self, attrs, instance=None):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user