title: 'QuerySet' object has no attribute 'filter_on_search' Python Django
body: <p>Can anyone please suggest me why I am getting this error. </p>
  
  <p>Following is model with Manager</p>
  
  <pre><code>class Customer(models.Model):
      customer_id     = models.AutoField(primary_key=True)
      customer_name   = models.CharField(max_length=256)
      customer_mobile = models.CharField(max_length=10)
      customer_email  = models.CharField(max_length=100,null=True)
      customer_dob    = models.DateField()
      customer_remarks= models.CharField(max_length=256,null=True)
      row_status      = models.BooleanField(choices=ROW_STATUS, default=True)
      created_date    = models.DateTimeField()
      updated_date    = models.DateTimeField()
  
      objects         = MyClassManager()
  
      def __unicode__(self):
          return self.customer_name
  
      def as_dict(self):
          """
          Create data for datatables ajax call.
          """
          return {'customer_name': self.customer_name,
                  'customer_mobile': self.customer_mobile,
                  'customer_dob': self.customer_dob,
                  }
  </code></pre>
  
  <p>Manager Starts here ---------</p>
  
  <pre><code>class MyClassMixin(object):
      def q_for_search_word(self, word):
          """
          Given a word from the search text, return the Q object which you can filter on,
          to show only objects containing this word.
          Extend this in subclasses to include class-specific fields, if needed.
          """
          return Q(name__icontains=word) | Q(supplier__name__icontains=word)
  
      def q_for_search(self, search):
          """
          Given the text from the search box, search on each word in this text.
          Return a Q object which you can filter on, to show only those objects with _all_ the words present.
          Do not expect to override/extend this in subclasses.
          """
          q = Q()
          if search:
              searches = search.split()
              for word in searches:
                  q = q &amp; self.q_for_search_word(word)
          return q
  
      def filter_on_search(self, search):
          """
          Return the objects containing the search terms.
          Do not expect to override/extend this in subclasses.
          """
          return self.filter(self.q_for_search(search))
  
  class MyClassQuerySet(QuerySet, MyClassMixin):
      pass
  
  class MyClassManager(models.Manager, MyClassMixin):
      def get_query_set(self):
          return MyClassQuerySet(self.model, using=self._db)
  </code></pre>
  
  <p>This is my view  -----</p>
  
  <pre><code>class MyAPI(JSONViewMixin, View):
      "Return the JSON representation of the objects"
      def get(self, request, *args, **kwargs):
  
          class_name = kwargs.get('cls_name')
          params = request.GET
          # make this api general enough to handle different classes
          klass = getattr(sys.modules['mudraapp.models'], class_name)
  
          # TODO: this only pays attention to the first sorting column
          sort_col_num = params.get('iSortCol_0', 0)
          # default to value column
          sort_col_name = params.get('mDataProp_{0}'.format(sort_col_num), 'value')
          search_text = params.get('sSearch', '').lower()
          sort_dir = params.get('sSortDir_0', 'asc')
          start_num = int(params.get('iDisplayStart', 0))
          num = int(params.get('iDisplayLength', 25))
          obj_list = klass.objects.all()
          sort_dir_prefix = (sort_dir=='desc' and '-' or '')
          if sort_col_name in col_name_map:
              sort_col = col_name_map[sort_col_name]
              obj_list = obj_list.order_by('{0}{1}'.format(sort_dir_prefix, sort_col))
  
          filtered_obj_list = obj_list
          if search_text:
              filtered_obj_list = obj_list.filter_on_search(search_text) //Here I am getting error
  
          d = {"iTotalRecords": obj_list.count(),                # num records before applying any filters
              "iTotalDisplayRecords": filtered_obj_list.count(), # num records after applying filters
              "sEcho":params.get('sEcho',1),                     # unaltered from query
              "aaData": [obj.as_dict() for obj in filtered_obj_list[start_num:(start_num+num)]] # the data
          }
  
          return self.json_response(d)
  </code></pre>
  
  <p>I am using this code for datatable pagination and search pagination works good but while search it gives error
  I am following following Tutorial for this
  <a href="http://racingtadpole.com/blog/datatables-with-ajax-and-django/" rel="nofollow">http://racingtadpole.com/blog/datatables-with-ajax-and-django/</a></p>