2๐
โ
By default, a FormView
(actually, any subclass of ProcessFormView
) will return a HttpResponseRedirect
in form_valid
. As you are calling the super
โs method in your form_valid
method, you also return a HttpResponseRedirect
. In the process, the actual POST
data is lost, and though you pass it as a GET
parameter, it is not used in the actual form.
To fix this, you need to not call super
in your form_valid
method, but instead return a rendered template in a HttpResponse
object, e.g.:
def form_valid(self, form):
self.query = form.cleaned_data['query']
self.concepts = # here is a long DB query; function(query)
return self.render_to_response(self.get_context_data(form=form))
๐คknbk
Source:stackexchange.com