Skip to content

Commit

Permalink
Minor rewording to release notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nessita committed Aug 9, 2023
1 parent d03748f commit a969f09
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/releases/5.0.txt
Expand Up @@ -133,10 +133,11 @@ More options for declaring field choices
----------------------------------------

:attr:`.Field.choices` *(for model fields)* and :attr:`.ChoiceField.choices`
*(for form fields)* use a list of 2-tuples as the canonical form for declaring
choices values. :ref:`field-choices-enum-types`, introduced in Django 3.0,
required use of the ``.choices`` attribute to provide the choices in the
expected form::
*(for form fields)* allow for more flexibility when declaring their values. In
previous versions of Django, ``choices`` should either be a list of 2-tuples,
or an :ref:`field-choices-enum-types` subclass, but the latter required
accessing the ``.choices`` attribute to provide the values in the expected
form::

from django.db import models

Expand All @@ -154,9 +155,9 @@ expected form::
medal = models.CharField(..., choices=Medal.choices)
sport = models.CharField(..., choices=SPORT_CHOICES)

Django 5.0 allows providing a mapping instead of an iterable and also no longer
requires ``.choices`` to be used directly to expand :ref:`enumeration types
<field-choices-enum-types>` into canonical form::
Django 5.0 supports providing a mapping instead of an iterable, and also no
longer requires ``.choices`` to be used directly to expand :ref:`enumeration
types <field-choices-enum-types>`::

from django.db import models

Expand All @@ -174,8 +175,8 @@ requires ``.choices`` to be used directly to expand :ref:`enumeration types
medal = models.CharField(..., choices=Medal) # Using `.choices` not required.
sport = models.CharField(..., choices=SPORT_CHOICES)

Under the hood the provided choices are normalized into the canonical form
whenever the ``choices`` value is updated.
Under the hood the provided ``choices`` are normalized into a list of 2-tuples
as the canonical form whenever the ``choices`` value is updated.

Minor features
--------------
Expand Down

0 comments on commit a969f09

Please sign in to comment.