multiple choice field doesn't show queryset in django

django, django-forms

Solution

`MultipleChoiceField` doesn't accept a `queryset` argument, but it does accept `choices`: https://docs.djangoproject.com/en/dev/ref/forms/fields/#multiplechoicefield

ModelMultipleChoiceField accepts a queryset.

Problem

I am attempting to create a multiple choice field populated by a queryset. My form looks like this: ``` class GroupLocationForm(forms.Form): groups_field = forms.MultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple) def __init__(self, customer_id, group_id): super(GroupLocationForm, self).__init__() customer = Customer.objects.get(pk=customer_id) self.fields['groups_field'].queryset = Group.objects.filter(location__customer = customer).distinct() ``` Nothing shows up in terms of choices in my form. If I add: ``` MY_CHOICES = ( (1,'choice 1'), ) groups_field = forms.MultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple, choices=MY_CHOICES) ``` The choice shows up without any problems. Why is my queryset not being assigned to the widget?

Original source