mirror of
https://github.com/encode/django-rest-framework.git
synced 2026-02-18 05:00:33 +03:00
Update serializers.py
Re-introduced old example mentioned
This commit is contained in:
parent
8f0bd561e9
commit
765b0904aa
|
|
@ -841,6 +841,14 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
|
|||
|
||||
This check is invoked internally by default `ModelSerializer.create()`
|
||||
and `ModelSerializer.update()` implementations.
|
||||
|
||||
Eg. Suppose we have a `UserSerializer` with a nested profile. How should
|
||||
we handle the case of an update, where the `profile` relationship does
|
||||
not exist? Any of the following might be valid:
|
||||
|
||||
* Raise an application error.
|
||||
* Silently ignore the nested part of the update.
|
||||
* Automatically create a profile instance.
|
||||
"""
|
||||
|
||||
ModelClass = serializer.Meta.model
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user