Esempio n. 1
0
def search(request):
    query_string = request.GET.get('q', None)
    clip_query = search_util.get_query(query_string, ['name', 'description'])
    hour_query = search_util.get_query(query_string, ['description'])
    clips = Clip.objects.filter(clip_query)
    hours = Hour.objects.filter(hour_query)
    return render(request, 'results.html', {
        'query': query_string,
        'clips': clips,
        'hours': hours,
    })
Esempio n. 2
0
 def search(self, search_string):
     """Convenience method of searching postings"""
     # search_string = search_string.strip()
     search_query = get_query( search_string, ['title', 'body', 'user__first_name', 'user__last_name'] )
     
     queryset = self.get_query_set()
     return queryset.filter(search_query)