# later in forms.py
category = forms.TypedChoiceField(required=False, choices=get_categories)
This has a similar effect to the ModelChoiceField, with the query only
running when the form is instantiated, but gives you the flexibility to use
whatever logic you'd like to come up with the choices for
On Aug 18, 2017 3:14 PM, "Jim Illback" wrote:
Here’s a “problem” with migrations that I’ve had. It only occurs on a first
time installation (like a first-time upload to Heroku, for example).
In forms.py, I have a field dependent upon a column in another table
(Category):
category = forms.Typ
2 matches
Mail list logo