Project

General

Profile

« Previous | Next » 

Revision 9dc52fdd

Added by Jérôme Schneider over 11 years ago

agenda: search worker by last_name fix #2473

View differences:

calebasse/ressources/lookups.py
18 18

  
19 19
class WorkerOrGroupLookup(LookupChannel):
20 20
    model = Worker
21
    search_field = 'display_name'
21
    search_field = 'last_name'
22 22

  
23 23
    def get_query(self, q, request):
24 24
        service = None
......
31 31
                pass
32 32

  
33 33
        if service:
34
            kwargs = { "%s__icontains" % self.search_field : q }
34
            kwargs = { "%s__istartswith" % self.search_field : q }
35 35
            group = FakeGroup('group:%s' % service.id, service.name)
36 36
            return itertools.chain([group], self.model.objects.for_service(service.id).order_by('last_name'))
37 37

  
38
        kwargs = { "%s__icontains" % self.search_field : q }
38
        kwargs = { "%s__istartswith" % self.search_field : q }
39 39
        return self.model.objects.filter(enabled=True).filter(**kwargs).order_by('last_name')
40 40

  
41 41
    def get_result(self, obj):

Also available in: Unified diff