views:

286

answers:

1

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())
+5  A: 

You want to use a ModelChoiceField.

class ContactFilterByClassificationForm(forms.Form):
    kam = forms.ModelChoiceField(queryset=User.objects.all())
Ben James
Great that works! Thanks!
Tom Tom