Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1624: SearchQuerySet is instantiated at startup #1625

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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