Re: How to do a bulk update?

2007-12-19 Thread Malcolm Tredinnick
On Wed, 2007-12-19 at 06:25 -0800, shabda wrote: > Ah. I see this ticket has a patch. Any thing specific this is waiting > for? The patch attached to the ticket doesn't do anything useful. It's exactly the same as doing the loop in your own code. If we're going to add an update method, it

Re: How to do a bulk update?

2007-12-19 Thread shabda
Ah. I see this ticket has a patch. Any thing specific this is waiting for? Since I was really hoping for something like this, any thing specific I can help you with to close this? (I have not really looked inside Django, but I may be able to help you test it?) On Dec 19, 6:45 pm, Malcolm

Re: How to do a bulk update?

2007-12-19 Thread Malcolm Tredinnick
On Wed, 2007-12-19 at 05:35 -0800, shabda wrote: > I have a QuerySet returned by a call like this > > foos = Foo.objects.filter(id__in = [1, 2, 3]) > > Now I want to update each of these elements' attributes to a specific > value. What I need to do is some thing like, > > for foo in foos: >

How to do a bulk update?

2007-12-19 Thread shabda
I have a QuerySet returned by a call like this foos = Foo.objects.filter(id__in = [1, 2, 3]) Now I want to update each of these elements' attributes to a specific value. What I need to do is some thing like, for foo in foos: foo.price = 0 foo.save() But this would make as many