summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorPreston Holmes <preston@ptone.com>2013-07-24 14:58:14 -0700
committerPreston Holmes <preston@ptone.com>2013-07-24 14:58:14 -0700
commit10f8a2100279621ca0e0fa47d99ee744741a05e7 (patch)
tree6f6384ebab66614b5493b7d8d1fb0f045aab90d8 /docs/ref
parentbd0dcc6c89e262780df3c17f18b2462f50b48137 (diff)
Fixed #18168 -- clarified precedence of validation
any choices set by formfield_for_choice_field are still subject to model validation of the model field's choices attribute
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index e5e9428805..137d20a351 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1389,6 +1389,15 @@ templates used by the :class:`ModelAdmin` views:
kwargs['choices'] += (('ready', 'Ready for deployment'),)
return super(MyModelAdmin, self).formfield_for_choice_field(db_field, request, **kwargs)
+ .. admonition:: Note
+
+ Any ``choices`` attribute set on the formfield will limited to the form
+ field only. If the corresponding field on the model has choices set,
+ the choices provided to the form must be a valid subset of those
+ choices, otherwise the form submission will fail with
+ a :exc:`~django.core.exceptions.ValidationError` when the model itself
+ is validated before saving.
+
.. method:: ModelAdmin.get_changelist(self, request, **kwargs)
Returns the ``Changelist`` class to be used for listing. By default,