#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
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

 * owner:  starryrbs => Nick Pope
 * has_patch:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 Hi. Thanks for the report.

 So looking at this, I don't think that making it possible to customise the
 `.label` property name is the right approach.

 `Enum` doesn't have a problem providing `.name` or `.value` attributes on
 the members while still allowing those names to be used as member names.
 I have something sorted out that will fix this for `.label` and
 `.do_not_call_in_templates` (although the latter is rather niche!)

 This is also broken for `.names`, `.values`, `.labels`, and `.choices`.
 These are, however, probably not fixable as they must exist on the top-
 level class itself and not the members, so they would collide with the
 member names. Perhaps this part of the problem can be addressed with some
 documentation.

 Alternate [https://github.com/django/django/pull/14022 PR].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32460#comment:2>
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.c5e75e21e42a391911f0eb08e2e05301%40djangoproject.com.

Reply via email to