#28033: Allow passing choices as a callable in a model field
-------------------------------------+-------------------------------------
Reporter: Ian Foote | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords: choices
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently
[https://docs.djangoproject.com/en/1.11/ref/models/fields/#choices
Field.choices] requires a fixed iterable, but this is not flexible for
choices that depend on information like the current date/time (eg I want
the next five years) or a value from {{{settings.py}}} which might change
between projects. Allowing a callable to be passed would allow the current
choices to be generated on demand and would avoid causing spurious
migrations when a setting is changed.
--
Ticket URL: <https://code.djangoproject.com/ticket/28033>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.6445fa7b00576968bc87e01a0920da58%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.