Proper way of passing query from form to url in Django class based view

19 views
Skip to first unread message

dsfqce cwfe

unread,
Dec 12, 2016, 9:17:38 AM12/12/16
to Django users
I want to learn a proper way of passing query from form to url in Django class based view. I want to retrieve form data in ListView to make query on the model.

I'm currently using this, but i feel that there's a better way.

class SearchFormView(FormView):
    form_class = SearchForm
    ...
    def form_valid(self, form):
        return HttpResponseRedirect('?'+urllib.parse.urlencode(form.data))
Reply all
Reply to author
Forward
0 new messages