mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Fixed #5327 -- Added standardized field information to ModelChoiceField and ModelMultipleChoiceField documentation. Thanks to danielrubio for the report and PhiR for the text.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14214 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8d364763ed
commit
767cf955d2
@ -856,6 +856,12 @@ objects (in the case of ``ModelMultipleChoiceField``) into the
|
||||
|
||||
.. class:: ModelChoiceField(**kwargs)
|
||||
|
||||
* Default widget: ``Select``
|
||||
* Empty value: ``None``
|
||||
* Normalizes to: A model instance.
|
||||
* Validates that the given id exists in the queryset.
|
||||
* Error message keys: ``required``, ``invalid_choice``
|
||||
|
||||
Allows the selection of a single model object, suitable for
|
||||
representing a foreign key. A single argument is required:
|
||||
|
||||
@ -901,6 +907,14 @@ example::
|
||||
|
||||
.. class:: ModelMultipleChoiceField(**kwargs)
|
||||
|
||||
* Default widget: ``SelectMultiple``
|
||||
* Empty value: ``[]`` (an empty list)
|
||||
* Normalizes to: A list 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``
|
||||
|
||||
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…
Reference in New Issue
Block a user