Skip to content

Commit

Permalink
[1.6.x] Fixed #23250 -- Documented that ModelMultipleChoiceField quer…
Browse files Browse the repository at this point in the history
…yset may be None.

Backport of ced3e30 from master
  • Loading branch information
timgraham committed Aug 26, 2014
1 parent adb0c53 commit 8e77ac6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/ref/forms/fields.txt
Expand Up @@ -956,6 +956,17 @@ model object (in the case of ``ModelChoiceField``) or multiple model
objects (in the case of ``ModelMultipleChoiceField``) into the objects (in the case of ``ModelMultipleChoiceField``) into the
``cleaned_data`` dictionary of the form. ``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`` ``ModelChoiceField``
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~


Expand Down

0 comments on commit 8e77ac6

Please sign in to comment.