how to using form as the search field in django -


i'm using listview, rewrite get_queryset method search, , use form let user input values, here comes problem: user input forms , leave forms empty, form.is_valid() method returns false, , can't values using form.cleaned_data, how fix this?

my code this:

class getstudentqueryhandler(listview):     template_name = 'client.html'     paginate_by = student_per_page     context_object_name = 'studentinfo'      def get_context_data(self, **kwargs):         context = super(getstudentqueryhandler, self).get_context_data(**kwargs)         context['can_show_distribute'] = self.request.user.has_perm('student.can_show_distribute_page')         context['queryform'] = querystudentform         context['setstudentform'] = setstudentform          return context      def get_queryset(self):         form = querystudentform(self.request.get)         if form.is_valid():             form_data = form.cleaned_data              arguments = {}             k, v in form_data.items():                 if v:                     arguments[k] = v               students = students.filter(**arguments) 


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -