mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #14567 -- Made ModelMultipleChoiceField return EmptyQuerySet as empty value
This commit is contained in:
parent
d25a599dca
commit
218abcc9e5
6 changed files with 40 additions and 7 deletions
|
@ -997,13 +997,17 @@ objects (in the case of ``ModelMultipleChoiceField``) into the
|
|||
.. class:: ModelMultipleChoiceField(**kwargs)
|
||||
|
||||
* Default widget: ``SelectMultiple``
|
||||
* Empty value: ``[]`` (an empty list)
|
||||
* Normalizes to: A list of model instances.
|
||||
* Empty value: An empty ``QuerySet`` (self.queryset.none())
|
||||
* Normalizes to: A ``QuerySet`` of model instances.
|
||||
* Validates that every id in the given list of values exists in the
|
||||
queryset.
|
||||
* Error message keys: ``required``, ``list``, ``invalid_choice``,
|
||||
``invalid_pk_value``
|
||||
|
||||
.. versionchanged:: 1.5
|
||||
The empty and normalized values were changed to be consistently
|
||||
``QuerySets`` instead of ``[]`` and ``QuerySet`` respectively.
|
||||
|
||||
Allows the selection of one or more model objects, suitable for
|
||||
representing a many-to-many relation. As with :class:`ModelChoiceField`,
|
||||
you can use ``label_from_instance`` to customize the object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue