Re: QuerySets in Dictionaries

2009-11-17 Thread scoopseven
On Nov 14, 11:55 pm, Steven D'Aprano wrote: > On Fri, 13 Nov 2009 14:10:10 -0800, scoopseven wrote: > > I actually had a queryset that was dynamically generated, so I ended up > > having to use the eval function, like this... > > > d = {} > > for thing in things: > >         query_name = 'thing_'

Re: QuerySets in Dictionaries

2009-11-14 Thread Steven D'Aprano
On Fri, 13 Nov 2009 14:10:10 -0800, scoopseven wrote: > I actually had a queryset that was dynamically generated, so I ended up > having to use the eval function, like this... > > d = {} > for thing in things: > query_name = 'thing_' + str(thing.id) > query_string = 'Thing.object

Re: QuerySets in Dictionaries

2009-11-14 Thread Diez B. Roggisch
scoopseven schrieb: On Nov 12, 8:55 pm, Steven D'Aprano wrote: On Thu, 12 Nov 2009 10:39:33 -0800, scoopseven wrote: I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject

Re: QuerySets in Dictionaries

2009-11-13 Thread Jerry Hill
On Fri, Nov 13, 2009 at 5:10 PM, scoopseven wrote: > I actually had a queryset that was dynamically generated, so I ended > up having to use the eval function, like this... > > d = {} > for thing in things: >query_name = 'thing_' + str(thing.id) >query_string = 'Thing.objects.filt

Re: QuerySets in Dictionaries

2009-11-13 Thread scoopseven
On Nov 12, 8:55 pm, Steven D'Aprano wrote: > On Thu, 12 Nov 2009 10:39:33 -0800, scoopseven wrote: > > I need to create a dictionary of querysets.  I have code that looks > > like: > > > query1 = Myobject.objects.filter(status=1) > > query2 = Myobject.objects.filter(status=2) > > query3 = Myobject

Re: QuerySets in Dictionaries

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 10:39:33 -0800, scoopseven wrote: > I need to create a dictionary of querysets. I have code that looks > like: > > query1 = Myobject.objects.filter(status=1) > query2 = Myobject.objects.filter(status=2) > query3 = Myobject.objects.filter(status=3) > > d={} > d['a'] = query

Re: QuerySets in Dictionaries

2009-11-12 Thread Diez B. Roggisch
scoopseven schrieb: I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to

Re: QuerySets in Dictionaries

2009-11-12 Thread Simon Brunning
2009/11/12 scoopseven : > I need to create a dictionary of querysets.  I have code that looks > like: > > query1 = Myobject.objects.filter(status=1) > query2 = Myobject.objects.filter(status=2) > query3 = Myobject.objects.filter(status=3) > > d={} > d['a'] = query1 > d['b'] = query2 > d['c'] = quer

QuerySets in Dictionaries

2009-11-12 Thread scoopseven
I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to do this that I'm missi