summaryrefslogtreecommitdiff
path: root/docs/ref/forms/fields.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-08-27 07:43:13 -0400
committerTim Graham <timograham@gmail.com>2014-08-27 07:43:13 -0400
commit83762da3fbc00fdb5c6cfbcd04e25ff00c599102 (patch)
tree7721841e02a9aaffc358bbb1d6b689c11ee70517 /docs/ref/forms/fields.txt
parent215400480217dc868cb637f0081d6ba05859b956 (diff)
Fixed #23354 -- Documented that ModelChoiceField to_field_name should be a unique field.
Thanks Keryn Knight for the suggestion.
Diffstat (limited to 'docs/ref/forms/fields.txt')
-rw-r--r--docs/ref/forms/fields.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index b855e2a10d..bd7cb93389 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -1106,8 +1106,10 @@ method::
.. attribute:: to_field_name
This optional argument is used to specify the field to use as the value
- of the choices in the field's widget. By default it is set to ``None``,
- in which case the primary key of each object will be used. For example::
+ of the choices in the field's widget. Be sure it's a unique field for
+ the model, otherwise the selected value could match more than one
+ object. By default it is set to ``None``, in which case the primary key
+ of each object will be used. For example::
# No custom to_field_name
field1 = forms.ModelChoiceField(queryset=...)