class CountrySelectForm forms Form country forms ModelChoiceField quer

1
2
3
4
5
6
class CountrySelectForm(forms.Form):
country = forms.ModelChoiceField(queryset=Country.objects.all())
def __init__(self, *args, **kwargs):
self.base_fields['country'].label_from_instance = lambda obj: smart_unicode(obj.name)
super(CountrySelectForm, self).__init__(*args, **kwargs)