Skip to content

Commit

Permalink
Fixes #1624: SearchQuerySet is instantiated at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptiste Darthenay committed Jul 5, 2018
1 parent 4910ccb commit b607696
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion haystack/generic_views.py
Expand Up @@ -44,7 +44,6 @@ class SearchMixin(MultipleObjectMixin, FormMixin):
template_name = "search/search.html"
load_all = True
form_class = ModelSearchForm
queryset = SearchQuerySet()
context_object_name = None
paginate_by = RESULTS_PER_PAGE
paginate_orphans = 0
Expand All @@ -54,6 +53,11 @@ class SearchMixin(MultipleObjectMixin, FormMixin):
search_field = "q"
object_list = None

def get_queryset(self):
if self.queryset is None:
self.queryset = SearchQuerySet()
return self.queryset

def get_form_kwargs(self):
"""
Returns the keyword arguments for instantiating the form.
Expand Down

0 comments on commit b607696

Please sign in to comment.