Allow ChoiceField and friends to take a callable for choices kwarg
|Reported by:||jdunck||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Sometimes we'd like choices to be dynamic (often the result of an ORM query), but because models are declarative, this forces queries to run with Django partially loaded.
It would be good to be able to make choices a callable so that these queries could be deferred until Django is fully loaded.
I'm attaching a rough patch; if this passes design-decision, I can polish it up with tests.
Change History (4)
Changed 3 years ago by jdunck
comment:1 Changed 3 years ago by jezdez
- Component changed from Uncategorized to Forms
- Triage Stage changed from Unreviewed to Accepted