#34388: Added support for direct usage of Choices classes on model fields
-------------------------------------+-------------------------------------
Reporter: T. Franzel | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by T. Franzel):
* stage: Accepted => Unreviewed
Comment:
> There is though a constant stream of complaints that run from “Django’s
loose APIs mean it can’t be typed” to (even) “Django is holding back
typing in Python” because of this.
Excuse my ignorance, but I don't really understand. In general I can see
what people mean by that, but it is really a valid point in this context?
@carlton can you point to a discussion on this topic? I would like to read
up on this before stating nonsense.
> If we do this, we should only allow Choices subclasses, not generic
enums.
+2 . That is of course the logical ...."choice" 😅. `Enums` is actually
missing the functionality and would indeed be watering down the interface,
for which the initial critique would be appropriate. But that wasn't even
the proposal. `isinstance(choices, ChoicesMeta)` should have that covered,
right?
> There's a separate question about storing the reference to the Choices
class... — and whether that would be public or not... (Given that's not
used by Django, I'd lean to a decorator approach in the library using it,
as I indicated, but …)
Let's just throw out the "retaining the reference" part. Absolutely fine
by me.
Apart from that I would update the PR (code and **doc**) to align it with
the new scope of the ticket if that is alright.
--
Ticket URL: <https://code.djangoproject.com/ticket/34388#comment:10>
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/01070186cca6c6a6-9880d462-f531-4758-8091-16dac16b76df-000000%40eu-central-1.amazonses.com.