diff options
Diffstat (limited to 'api-guide/serializers')
| -rw-r--r-- | api-guide/serializers/index.html | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/api-guide/serializers/index.html b/api-guide/serializers/index.html index 71da4a99..54888896 100644 --- a/api-guide/serializers/index.html +++ b/api-guide/serializers/index.html @@ -370,6 +370,10 @@ </li> <li> + <a href="#accessing-the-initial-data-and-instance">Accessing the initial data and instance</a> + </li> + + <li> <a href="#partial-updates">Partial updates</a> </li> @@ -736,6 +740,9 @@ class GameRecord(serializers.Serializer): ) </code></pre> <p>For more information see the <a href="../validators">validators documentation</a>.</p> +<h2 id="accessing-the-initial-data-and-instance">Accessing the initial data and instance</h2> +<p>When passing an initial object or queryset to a serializer instance, the object will be made available as <code>.instance</code>. If no initial object is passed then the <code>.instance</code> attribute will be <code>None</code>.</p> +<p>When passing data to a serializer instance, the unmodified data will be made available as <code>.initial_data</code>. If the data keyword argument is not passed then the <code>.initial_data</code> attribute will not exist.</p> <h2 id="partial-updates">Partial updates</h2> <p>By default, serializers must be passed values for all required fields or they will raise validation errors. You can use the <code>partial</code> argument in order to allow partial updates.</p> <pre><code># Update `comment` with partial data |
