I made it that way but i get empty select list

class ProvinceForm(ModelForm):
    def __init__(self, *args, **kwargs):
        super(ProvinceForm, self).__init__(*args, **kwargs)
        user_provinces = 
UserProvince.objects.select_related().filter(user__exact=self.instance.id).values_list('province')
        self.fields['name'].choices = 
Province.objects.exclude(id__in=user_provinces).values_list('id', 'name')

    class Meta:
        model = Province
        fields = ('name',)
        widgets = {
            'name': Select(),
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to