#32460: TextChoices/IntegerChoices can not have a member with name `label`
-------------------------------------+-------------------------------------
     Reporter:  elonzh               |                    Owner:  Nick Pope
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Choices              |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Nick Pope):

 Replying to [comment:3 elonzh]:
 > using methods to get such members? like `get_labels()`, these methods
 introduce API changes but I think it's a clear solution?

 Every example in the [https://docs.python.org/3/library/enum.html enum]
 documentation and the
 [https://docs.djangoproject.com/en/3.1/ref/models/fields/#field-choices-
 enum-types Field.choices] documentation uses the convention of uppercase
 member names. Maybe I was naive to assume that people wouldn't use
 lowercase member names.

 While we could rename these, I'm not sure it is worth the change. We'd
 need to deprecate first for a few releases. It will annoy lots of people
 who will then have to update this for a small edge case. On top of that,
 the names `get_labels`, etc. would also then not be allowed, merely
 shifting the problem. At the end of the day, these choices helper classes
 are not compulsory and, as documented, a sequence can be used.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32460#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.60e4ac6339e8ef10d9f6cc209cca87bb%40djangoproject.com.

Reply via email to