This looks like a foreign key relationship (probably should be if it's
not). Use ModelChoiceField instead of ChoiceField. I haven't used it
manually in a form before, but try this:
instrument = ModelChoiceField(queryset=Instrument.objects.all(),
cache_choices=False, required=False)
Note that thi
Hi,
I have a form on my project which has a drop down list with several
options that are loaded from a table in a database.
The code is this:
class ProductForm(forms.Form):
instrument_Name=ChoiceField(required=False,
choices=[(i.instrument_name,i.instrument_name) for i in
Instrument.objects.a
2 matches
Mail list logo