#1697 closed enhancement (fixed)
[patch] magic-removal: the choices keyword for Fields is restricted
Reported by: | brantley | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | magic-removal |
Severity: | normal | Keywords: | validate choices |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The choices keyword is restricted to a list or tuple by the management.py, get_validation_errors(). It should instead allow anything that is iterable. For instance, a generator could then be used. I've attached a simple patch.
Attachments (1)
Change History (4)
by , 19 years ago
Attachment: | iterable.diff added |
---|
comment:1 by , 19 years ago
Note that (I think) this will also allow strings, which will result in a different behavior than the developer would probably expect.
comment:2 by , 19 years ago
Yes, it would be allowed by the validation, but would not work as the system will expect two-tuples. But I'm not sure if validate should check each item of the iterable or what.
comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
patch