#31261: Add support for defining models.Choices fields with dict, tuple, set and
list values.
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Shai Berger):
Replying to [comment:7 Shai Berger]:
> Replying to [comment:4 felixxm]:
> > Replying to [comment:2 Adam (Chainz) Johnson]:
> > > As I wrote on the forum post, we can detect if dict/list/set/tuple
is in the MRO and disable this functionality in those (probably very rare)
cases.
> >
> > Can we? e.g.
[https://github.com/django/django/blob/master/tests/model_enums/tests.py#L179-L185
MoonLandings] each option is defined by tuple but none of them is a group.
>
> I'm pretty sure we can't.
Actually, looking again at the forum discussion, the original suggestion
was to only special-case dict/list/set. This would, generally, work, all
the reservations above are specifically about tuples; and further,
`Choices` values need to be also dictionary keys, so mutable types (like
dict, set and list) are already out anyway.
--
Ticket URL: <https://code.djangoproject.com/ticket/31261#comment:8>
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/061.a95c53c5f093891c47d8ac3b92e8756b%40djangoproject.com.