This is quite old but still relevant:
http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/
Basically, create your form and edit the widget with an __init__ like
this:
class FlightForm(forms.ModelForm):
def __init__(self, profile, *args, **kwargs):
super(FlightForm, self).__init__(
I have a model form in my project that has a field that is swapped out
for another field based on user preferences. Some users want a select
the value from a dropdown box, other people want to just type the
value into a textbox.
Before I had it like this:
def proper_flight_form(profile):
"""
2 matches
Mail list logo