Skip to content

Commit

Permalink
Fixed #35072 -- Corrected Field.choices description in models topic.
Browse files Browse the repository at this point in the history
  • Loading branch information
1zzowiebeha authored and felixxm committed Jan 1, 2024
1 parent c720016 commit 8fcd7b0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/topics/db/models.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,12 @@ ones:
<Field.blank>`, the field will be required.

:attr:`~Field.choices`
A :term:`sequence` of 2-tuples to use as choices for this field. If this
is given, the default form widget will be a select box instead of the
standard text field and will limit choices to the choices given.
A :term:`sequence` of 2-value tuples, a :term:`mapping`, an
:ref:`enumeration type <field-choices-enum-types>`, or a callable (that
expects no arguments and returns any of the previous formats), to use as
choices for this field. If this is given, the default form widget will be a
select box instead of the standard text field and will limit choices to the
choices given.

A choices list looks like this::

Expand Down Expand Up @@ -216,6 +219,10 @@ ones:
Further examples are available in the :ref:`model field reference
<field-choices>`.

.. versionchanged:: 5.0

Support for mappings and callables was added.

:attr:`~Field.default`
The default value for the field. This can be a value or a callable
object. If callable it will be called every time a new object is
Expand Down

0 comments on commit 8fcd7b0

Please sign in to comment.