aboutsummaryrefslogtreecommitdiffstats
path: root/api-guide/serializers/index.html
diff options
context:
space:
mode:
authorTom Christie2014-12-17 16:23:42 +0000
committerTom Christie2014-12-17 16:23:42 +0000
commit760da25c6018eff02b3aab33dc6fea7c93881d9f (patch)
treecda0f7ea1821d3054be7f9e9251e37b4c06281b7 /api-guide/serializers/index.html
parentc05c1f5c7cf562634382c25716d7a7588794f107 (diff)
downloaddjango-rest-framework-760da25c6018eff02b3aab33dc6fea7c93881d9f.tar.bz2
Update documentation
Diffstat (limited to 'api-guide/serializers/index.html')
-rw-r--r--api-guide/serializers/index.html7
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