Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.7.x] Fixed #23250 -- Documented that ModelMultipleChoiceField quer…

…yset may be None.

Backport of ced3e30 from master
  • Loading branch information...
commit 1b89f976f4919a36c6b70eba428c3a02a94e2822 1 parent 588afbb
@timgraham timgraham authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 docs/ref/forms/fields.txt
View
11 docs/ref/forms/fields.txt
@@ -1003,6 +1003,17 @@ model object (in the case of ``ModelChoiceField``) or multiple model
objects (in the case of ``ModelMultipleChoiceField``) into the
``cleaned_data`` dictionary of the form.
+For more complex uses, you can specify ``queryset=None`` when declaring the
+form field and then populate the ``queryset`` in the form's ``__init__()``
+method::
+
+ class FooMultipleChoiceForm(forms.Form):
+ foo_select = forms.ModelMultipleChoiceField(queryset=None)
+
+ def __init__(self, *args, **kwargs):
+ super(FooMultipleChoiceForm, self).__init__(*args, **kwargs)
+ self.fields['foo_select'].queryset = ...
+
``ModelChoiceField``
~~~~~~~~~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.