Opened 11 years ago
Closed 11 years ago
#20430 closed New feature (fixed)
Enable Any iterable of two item iterables to be used for choices
Reported by: | Donald Stufft | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Simon Charette | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently the validation checks in django.core.management.validation
check explicitly for
list
or
tuple
. This is less than ideal and flies in the face of duck typing. We should enable any iterable of two item iterables to be used for the choices field. This makes it pretty easy to use the upcoming Python 3.4 enums as a
choices=
(see: https://gist.github.com/dstufft/5600529#file-models-py-L61-L67).
There's a pull request for this here https://github.com/django/django/pull/1081
Change History (5)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|---|
Component: | Uncategorized → Database layer (models, ORM) |
Has patch: | set |
Needs documentation: | set |
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 11 years ago
Needs documentation: | unset |
---|
comment:4 by , 11 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
@charettes has mentioned that I should likely write tests ensuring that iterables remain working.