What about an extension to the Queryset like this:

    User.objects.filter(username__istartswith="a").update(is_active=True)

it would trigger something like this:

   UPDATE auth_user SET is_active=1 WHERE username LIKE "a%"

This syntax (if it existed) would solve the following problems
the current DB API is lacking (if i am not wrong)

1) direct updates, you always have to retreive the "rows"
    (via SELECT) and later update them one by one
2) you cant update multiple rows at once, you always have to
trigger an update one by one

Currently you have to do it like this:

users = User.objects.filter(username__istartswith="a")   # SELECT
for u in users:
    u.is_active = True
    u.save()  # UPDATE

The above triggers as many UPDATEs as there are users.
And first one SELECT statement to retreive the data.

The above suggested syntax would make that job much easier and
reduce the load on the DB dramatically (in some cases)!

-- 
cu

Wolfram

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to