aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2014-12-09 19:53:42 +0000
committerTom Christie2014-12-09 19:53:42 +0000
commit182313cbee83d36765e8f5cbc24bef535c4ef190 (patch)
treeb38b947b8e16aaee2da323b9935bbb35938bc15e
parenta345c321153c964f08beb45c1d299c04d07eb010 (diff)
downloaddjango-rest-framework-182313cbee83d36765e8f5cbc24bef535c4ef190.tar.bz2
Update documentation
-rw-r--r--api-guide/fields/index.html4
-rw-r--r--tutorial/5-relationships-and-hyperlinked-apis/index.html2
2 files changed, 5 insertions, 1 deletions
diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html
index 46fa5f68..2610e178 100644
--- a/api-guide/fields/index.html
+++ b/api-guide/fields/index.html
@@ -753,13 +753,17 @@ color_channel = serializers.ChoiceField(
<p><strong>Signature:</strong> <code>ChoiceField(choices)</code></p>
<ul>
<li><code>choices</code> - A list of valid values, or a list of <code>(key, display_name)</code> tuples.</li>
+<li><code>allow_blank</code> - If set to <code>True</code> then the empty string should be considered a valid value. If set to <code>False</code> then the empty string is considered invalid and will raise a validation error. Defaults to <code>False</code>.</li>
</ul>
+<p>Both the <code>allow_blank</code> and <code>allow_null</code> are valid options on <code>ChoiceField</code>, although it is highly recommended that you only use one and not both. <code>allow_blank</code> should be preferred for textual choices, and <code>allow_null</code> should be preferred for numeric or other non-textual choices.</p>
<h2 id="multiplechoicefield">MultipleChoiceField</h2>
<p>A field that can accept a set of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. <code>to_internal_representation</code> returns a <code>set</code> containing the selected values.</p>
<p><strong>Signature:</strong> <code>MultipleChoiceField(choices)</code></p>
<ul>
<li><code>choices</code> - A list of valid values, or a list of <code>(key, display_name)</code> tuples.</li>
+<li><code>allow_blank</code> - If set to <code>True</code> then the empty string should be considered a valid value. If set to <code>False</code> then the empty string is considered invalid and will raise a validation error. Defaults to <code>False</code>.</li>
</ul>
+<p>As with <code>ChoiceField</code>, both the <code>allow_blank</code> and <code>allow_null</code> options are valid, although it is highly recommended that you only use one and not both. <code>allow_blank</code> should be preferred for textual choices, and <code>allow_null</code> should be preferred for numeric or other non-textual choices.</p>
<hr />
<h1 id="file-upload-fields">File upload fields</h1>
<h4 id="parsers-and-file-uploads">Parsers and file uploads.</h4>
diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html
index 364de40d..4c126bbb 100644
--- a/tutorial/5-relationships-and-hyperlinked-apis/index.html
+++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html
@@ -457,7 +457,7 @@ We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</
class UserSerializer(serializers.HyperlinkedModelSerializer):
- snippets = serializers.HyperlinkedRelatedField(many=True, view_name='snippet-detail')
+ snippets = serializers.HyperlinkedRelatedField(many=True, view_name='snippet-detail', read_only=True)
class Meta:
model = User