#31262: Support dictionaries in Field.choices for named groups.
-------------------------------------+-------------------------------------
Reporter: Tom Forbes | Owner: Tom
| Forbes
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Forbes):
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/12449
This was actually hard to test. We have a lot of tests that use the list
syntax and it's really not easy to parametrize them to test with the
different ways of defining choices. I've added a few tests for the
specific functionality I've added - three supported variants:
1. the current format, lists of tuples
2. dictionaries containing tuples: `{"name": [(1, "one")]}`
3. nested dictionaries: `{"name": {1: "one"}}`
Under the hood the dictionary syntax is flattened into a list of tuples
for compatibility.
--
Ticket URL: <https://code.djangoproject.com/ticket/31262#comment:6>
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.5ae187606ac6b2dd6e01fb912d406c46%40djangoproject.com.