def basic_search(self, pattern):
        """
        Basic search on entries.
        """
        lookup = None
        for pattern in pattern.split():
            query_part = models.Q()
            for field in SEARCH_FIELDS:
                query_part |= models.Q(**{'%s__icontains' % field: pattern})
            if lookup is None:
                lookup = query_part
            else:
                lookup |= query_part

        return self.get_queryset().filter(lookup)
def basic_search ( self , pattern ) : lookup = None for pattern in pattern . split ( ) : query_part = models . Q ( ) for field in SEARCH_FIELDS : query_part |= models . Q ( ** { '%s__icontains' % field : pattern } ) if lookup is None : lookup = query_part else : lookup |= query_part return self . get_queryset ( ) . filter ( lookup )
Basic search on entries.