class CountryLevelOptimization(forms.Form):
name = forms.CharField()
country = forms.ChoiceField(widget=forms.Select, choices=(('A','a'),('B','b')))
Above is my Django form in which country is a ChoiceField Following is my python code.
def Homepage(request):
choices = (('Country1','India'),('Country2','USA'))
form = CountryLevelOptimization()
# How to pass choices to the form['country']
return render(request,"Dummy.html",{"form":form})
How can i pass choices to the country in from the view Homepage ?
please help me with this.