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())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With