aboutsummaryrefslogtreecommitdiffstats
path: root/api-guide/fields
diff options
context:
space:
mode:
authorXavier Ordoquy2015-01-10 10:41:12 +0100
committerXavier Ordoquy2015-01-10 10:41:12 +0100
commitd8dbd8679080035de4e785a8e7b998fb01f4052b (patch)
treebaceae881ed53e5a25295367f6a58bb6fe1c131e /api-guide/fields
parentc1e4ec0c64933da5411e4cc3e63894d5f82cc337 (diff)
downloaddjango-rest-framework-d8dbd8679080035de4e785a8e7b998fb01f4052b.tar.bz2
Update documentation
Diffstat (limited to 'api-guide/fields')
-rw-r--r--api-guide/fields/index.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html
index aedc4ea1..9cac530a 100644
--- a/api-guide/fields/index.html
+++ b/api-guide/fields/index.html
@@ -595,6 +595,7 @@
<h3 id="required"><code>required</code></h3>
<p>Normally an error will be raised if a field is not supplied during deserialization.
Set to false if this field is not required to be present during deserialization.</p>
+<p>Setting this to <code>False</code> also allows the object attribute or dictionary key to be omitted from output when serializing the instance. If the key is not present it will simply not be included in the output representation.</p>
<p>Defaults to <code>True</code>.</p>
<h3 id="allow_null"><code>allow_null</code></h3>
<p>Normally an error will be raised if <code>None</code> is passed to a serializer field. Set this keyword argument to <code>True</code> if <code>None</code> should be considered a valid value.</p>
@@ -879,7 +880,7 @@ class UserSerializer(serializers.ModelSerializer):
class ColorField(serializers.Field):
"""
- Color objects are serialized into "rgb(#, #, #)" notation.
+ Color objects are serialized into 'rgb(#, #, #)' notation.
"""
def to_representation(self, obj):
return "rgb(%d, %d, %d)" % (obj.red, obj.green, obj.blue)