Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:36:02+00:00 2026-06-16T11:36:02+00:00

I am using haystack to perform a simple search query against my Person model

  • 0

I am using haystack to perform a simple search query against my Person model for all the selected filter attributes. I have decide to try out the Faceted Search Form and created a generic TemplateView SearchView.

class SearchView(TemplateView):
    template_name = "index.html"
    results = EmptySearchQuerySet()
    form_class = FacetedSearchForm
    form = None
    query = ''
    selected_people = None

    def get(self, request, **kwargs):
        self.request = request
        self.query = self.get_query()
        if self.form.is_valid():
            self.results = self.get_results()
        context = self.get_context_data(request, **kwargs)

        if request.is_ajax() or request.GET.get('ajax'):
            self.template_name = 'search/Taleebo/search_results.html'

        return self.render_to_response(context)

    def get_query(self):
        return self.request.GET.get('q')

    def get_results(self):
        return self.form.search()

All the routing is working fine but when my get method is called it fails at the line

self.form.is_valid()

with an error that says NoneType' object has no attribute 'is_valid'

I am using the default form_class so shouldn’t that attribute be defined?

EDIT:

I am trying to now use the provided SearchView by haystack and the is_valid is no longer an issue but i am not getting any records back from ‘results’. I changed my urls.py to look like this

 url(r'^search/person/', search_view_factory(
    view_class=SearchView,
    template='index.html',
    form_class=ModelSearchForm
), name='haystack_search'),
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:36:04+00:00Added an answer on June 16, 2026 at 11:36 am

    Using any class would result in the same error, when you don’t have an instance to access:

    class SearchView(TemplateView):
    (...)
          form = None  //<= Here you set the form to None
    

    So you’re calling is_valid() on None, instead of on an actual form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I´m using django with haystack search. I have one model for Events. Thats
Using the django-haystack and solr as a search engine, I have successfully implemented a
i have problem with results in django-cms and haystack search. I'm using django-cms-search plugin,
I have a model with an ImageField that I'm indexing for search using Django
Im using haystack to search my django website, it does this perfectly. However on
I'm using django-haystack for a search page on my site. I'm basically done, but
I've installed the haystack app and I'm using the solr backend. Search works perfectly
I'm adding search to an existing Django site, using Haystack with a Solr backend.
I am using Haystack and ElasticSearch as the backend to implement search in my
I am using django-haystack with solr backend. I've saved three songs in model. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.