Ticket #6933: django-6933-0.3.diff

File django-6933-0.3.diff, 892 bytes (added by diafour, 16 years ago)
  • main.py

     
    731731            else:
    732732                return "%s__icontains" % field_name
    733733
     734        def query_split(query):
     735            first_bits = query.split('"')
     736            result_bits = first_bits[1::2]
     737                for bit in first_bits[0::2]:
     738                result_bits.extend( bit.split() )
     739            return result_bits
     740
    734741        if self.lookup_opts.admin.search_fields and self.query:           
    735             for bit in self.query.split():
     742            for bit in query_split(self.query):
    736743                or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields]
    737744                other_qs = QuerySet(self.model)
    738745                other_qs.dup_select_related(qs)
Back to Top