Re: help optimizing a snippet

2011-12-06 Thread Tom Evans
On Tue, Dec 6, 2011 at 2:24 PM, Felipe Morales wrote: > Hi, > > Maybe I can't understand you, but try with > > u = User.objects.filter(groups__name__in = > gruppe).exclude(groups__name__in='Timesheet-Boss','TimeSheet-Manager','Projektleiter','Normal-User','Manager']).values_list('id', > 'username'

AW: help optimizing a snippet

2011-12-06 Thread Szabo, Patrick (LNG-VIE)
Amazing12 queries left and that's hell of a lot faster J Thank you guys ! Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von Felipe Morales Gesendet: Dienstag, 06. Dezember 2011 15:24 An: django-users@googlegroups.com Betreff: Re: help optim

Re: help optimizing a snippet

2011-12-06 Thread Felipe Morales
Hi, Maybe I can't understand you, but try with u = User.objects.filter(groups__name__in = gruppe).exclude(groups__name__in= *'Timesheet-Boss'*,*'TimeSheet-Manager'*,*'Projektleiter'*,*'Normal-User'*,* 'Manager'*]).values_list('id', 'username') 2011/12/6 Szabo, Patrick (LNG-VIE) > Hi, > >

Re: help optimizing a snippet

2011-12-06 Thread Tom Evans
On Tue, Dec 6, 2011 at 1:42 PM, Szabo, Patrick (LNG-VIE) wrote: > Hi, > > > > I’v got this piece of code: > > > > def get_my_choices(gruppe): > >     users = User.objects.all() > >     choices_list = () > >     for user in users: > >     try: > >     for groupe in gruppe: > >  

help optimizing a snippet

2011-12-06 Thread Szabo, Patrick (LNG-VIE)
Hi, I'v got this piece of code: def get_my_choices(gruppe): users = User.objects.all() choices_list = () for user in users: try: for groupe in gruppe: for groupe2 in user.groups.all(): if groupe2 == groupe and (user