I would like to have several fields in my form that display as ChoiceFields that get their contents from the database.
I thought something like:
class SeriesForm(ModelForm): series = forms.ChoiceField(choices=Series.objects.all()) class Meta: model = Series exclude = ('model', 'date_added',)
But the series field no longer appears at all in my form. What am I missing?
After trying to solve (using ModelChoiceField ), I still see the same problem. Here is my code:
series = forms.ModelChoiceField(queryset=Series.objects.values('series'), empty_label=" ")
source share