Hi,
I want to create a form which has a dropdown with all users in it. I tried it like this, with no luck.
class ContactFilterByClassificationForm(forms.Form):
kam = forms.ChoiceField(choices=User.objects.all())
Hi,
I want to create a form which has a dropdown with all users in it. I tried it like this, with no luck.
class ContactFilterByClassificationForm(forms.Form):
kam = forms.ChoiceField(choices=User.objects.all())
You want to use a ModelChoiceField
.
class ContactFilterByClassificationForm(forms.Form):
kam = forms.ModelChoiceField(queryset=User.objects.all())