def get_context_data(self, **kwargs): context = super(SampleListView, self).get_context_data(**kwargs) search_form = SimpleSampleSearchForm(self.request.GET) if search_form.is_valid(): context[SEARCH_FORM] = search_form else: context[SEARCH_FORM] = SimpleSampleSearchForm() return context
def get_queryset(self): qs = super(SampleListView, self).get_queryset().order_by('-submission_time') search_form = SimpleSampleSearchForm(self.request.GET) if search_form.is_valid(): search_string = search_form.cleaned_data.get('search_string') qs = self.model.objects.run_search(search_string, qs=qs) return qs