1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #32460 -- Doc'd and tested that property names of model choice enums cannot be used as members.

This commit is contained in:
Nick Pope
2021-03-23 10:07:43 +01:00
committed by Mariusz Felisiak
parent 4894a97578
commit 41e39c41c9
2 changed files with 9 additions and 0 deletions

View File

@@ -226,6 +226,11 @@ modifications:
``.choices``, ``.labels``, ``.values``, and ``.names`` -- to make it easier
to access lists of those separate parts of the enumeration. Use ``.choices``
as a suitable value to pass to :attr:`~Field.choices` in a field definition.
.. warning::
These property names cannot be used as member names as they would conflict.
* The use of :func:`enum.unique()` is enforced to ensure that values cannot be
defined multiple times. This is unlikely to be expected in choices for a
field.