Re: Bulk get

2009-06-06 Thread Daniel Roseman
On Jun 6, 4:13 pm, Andrew Fong wrote: > Was hoping not to have to loop back through it -- but I guess I'll > just have to suck it up and do it. Thanks. > If you've got the order already in model_pk_list, you can use the order_by parameter to .extra() to get the results in that order straight f

Re: Bulk get

2009-06-06 Thread Andrew Fong
Was hoping not to have to loop back through it -- but I guess I'll just have to suck it up and do it. Thanks. On Jun 6, 11:04 am, Michael wrote: > On Sat, Jun 6, 2009 at 10:55 AM, Andrew Fong wrote: > > > Hi all, > > > I'm trying to figure out how to do this and can't seem to wrap my head > > a

Re: Bulk get

2009-06-06 Thread Michael
On Sat, Jun 6, 2009 at 10:55 AM, Andrew Fong wrote: > > Hi all, > > I'm trying to figure out how to do this and can't seem to wrap my head > around it today. I have currently have a piece of code like this: > > x = [MyModel.objects.get(pk=pk) for pk in model_pk_list] > x = MyModel.objects.filter

Bulk get

2009-06-06 Thread Andrew Fong
Hi all, I'm trying to figure out how to do this and can't seem to wrap my head around it today. I have currently have a piece of code like this: x = [MyModel.objects.get(pk=pk) for pk in model_pk_list] I want to modify this such that ... * Everything is done with one call to the DB instead len