Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
SearchQuerySet().filter(content='content') returns results, but they don't show up in search.html

I can go into my shell and type

 sqs = SearchQuerySet().filter(content='content')
 len(sqs)

and I get results. I have inspected them and when I type

 sqs[0]
 sqs[0].id
 sqs[0].text

I get coherent results. However when I use the search form on my website, I get no results.

I don't even define my own SearchView. It is the default one. On the template, I have tried

 {% for result in page.object_list %}
 {% for result in object_list %}
 {% for result in page_obj.object_list %}

and still don't get any results. And the query did run because I can put stuff inside

 {% if query %}

so that clearly works. What do I do?

Thank you.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I resolved this by replacing

  url(r'^search/', include('haystack.urls')),

with

 url(r'^search/?$', views.SearchResultsView.as_view(), name='search-view'),

and making my own SearchResultsView with nothing special in it

 class SearchResultsView(SearchView):
     template_name = 'search/search.html'
     form_class = MySearchForm
     queryset = SearchQuerySet().all()
     paginate_by = 10
     context_object_name = 'object_list'

and using

  page_obj

in the template

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!