title: django haystack custom form
body: <p>I'm trying to make a custom search form using django haystack, i just modify from haystack's documentation : </p>
  
  <p>forms.py</p>
  
  <pre><code>from django import forms
  from haystack.forms import SearchForm
  
  class DateRangeSearchForm(SearchForm):
      start_date = forms.DateField(required=False)
      end_date = forms.DateField(required=False)
  
     def search(self):
          # First, store the SearchQuerySet received from other processing.
          sqs = super(DateRangeSearchForm, self).search()
  
          # Check to see if a start_date was chosen.
          if self.cleaned_data['start_date']:
              sqs = sqs.filter(pub_date__gte=self.cleaned_data['start_date'])
  
          # Check to see if an end_date was chosen.
          if self.cleaned_data['end_date']:
              sqs = sqs.filter(pub_date__lte=self.cleaned_data['end_date'])
  
          return sqs
  </code></pre>
  
  <p>to : </p>
  
  <pre><code>from django import forms
  from haystack.forms import HighlightedModelSearchForm
  
  class CustomSearchForm(HighlightedModelSearchForm):
      title   = forms.CharField(max_length = 100, required = False)
      content = forms.CharField(max_length = 100, required = False)
      date_added = forms.DateField(required = False)
      post_by = forms.CharField(max_length = 100, required = False)
  
      def search(self):
          sqs = super(CustomSearchForm, self).search()
          if self.cleaned_data['post_by']:
              sqs = sqs.filter(content = self.cleaned_data['post_by'])
          if self.cleaned_data['title']:
              sqs = sqs.filter(content = self.cleaned_data['title'])
          if self.cleaned_data['content']:
              sqs = sqs.filter(content = self.cleaned_data['content'])
          if self.cleaned_data['date_added']:
              sqs = sqs.filter(content = self.cleaned_data['date_added']) 
          return sqs
  </code></pre>
  
  <p>haystack .urls : </p>
  
  <pre><code>urlpatterns = patterns('haystack.views',
      url(r'^$', search_view_factory(view_class = SearchView, form_class = CustomSearchForm), name='haystack_search'),
  )
  </code></pre>
  
  <p>when i go to the url, it says : AttributeError at /search/</p>
  
  <p>'CustomSearchForm' object has no attribute 'cleaned_data'</p>
  
  <p>can you guys help me? thx</p>
  
  <p>Then i try to comment the search method, but when i submit a word into the custom field, the result is always nothing, only when i submit a word to non-custom field it can gimme the result i want, already tried to understand this all day long, pls help</p>