Form:
class SearchJobForm(forms.Form):
query = forms.CharField()
types = forms.ModelChoiceField(queryset=JobType.objects.all(), widget=forms.CheckboxSelectMultiple())
View
def jobs_page(request):
if 'query' in request.GET:
form = SearchJobForm(request.GET)
else:
form = SearchJobForm()
variables = RequestContext(request, {
'form':form,
})
return render_to_response('jobs_page.html', variables)
After i submit the form i try to get its values back in the form
form = SearchJobForm(request.GET)
but it doesn't work(some fields dissapear). Maybe it's because of the ModelChoiceField. How do i fill the form with its values using get method?