Changes between Initial Version and Version 2 of Ticket #36930


Ignore:
Timestamp:
Feb 15, 2026, 5:46:33 AM (3 hours ago)
Author:
Antoine Humbert
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36930

    • Property Owner set to Antoine Humbert
    • Property Status newassigned
  • Ticket #36930 – Description

    initial v2  
    2020When using such definitions, the default value is not selected by default in forms created for such model. This is bescause the `str()` of the default value returns the string representation provided by `enum.Enum` instead of the string representation from `float`.
    2121
    22 I believe this is a regression in https://github.com/antoinehumbert/django/commit/fe19b33e2f76045617067dd5123041ae4d3a91ee where the `django.db.models.Choices.__str__` (which specifically called `str(self.value)`) method was removed to the profit of making `IntegerChoices` and `TextChoices` inherit from `enum.ReprEnum`). Unfortunaltly, this dropped the initial `Choices.__str__` behaviour for all other subclasses of `Choices`.
     22I believe this is a regression in https://github.com/django/django/commit/fe19b33e2f76045617067dd5123041ae4d3a91ee where the `django.db.models.Choices.__str__` (which specifically called `str(self.value)`) method was removed to the profit of making `IntegerChoices` and `TextChoices` inherit from `enum.ReprEnum`). Unfortunaltly, this dropped the initial `Choices.__str__` behaviour for all other subclasses of `Choices`.
    2323
    2424I think the fix is as simple as making `Choices` inherit from `enum.ReprEnum` instead of `enum.Enum`.
Back to Top