Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Calling update() on EmptyQuerySet updates all rows in database
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jens Ådne Rydland  
View profile  
 More options Nov 3, 7:42 am
From: Jens Ådne Rydland <jensa...@pvv.ntnu.no>
Date: Tue, 3 Nov 2009 13:42:19 +0100
Local: Tues, Nov 3 2009 7:42 am
Subject: Calling update() on EmptyQuerySet updates all rows in database
Came across an issue with EmptyQuerySet today, it seems it does not
behave correctly with regard to update(). (or that the documentation is
lacking, I suspect it's the former)

Assuming I have a model Foo of which I have say 42 stored instances in
the database, each with a CharacterField "bar".

If I do Foo.objects.none().count() I get the expected result 0.
However, Foo.objects.none().update(bar='baz') returns 42, and all 42
rows in the database have been updated.

This seems to be caused by EmptyQuerySet not overriding update(),
shouldn't this just return 0?

--
best regards, Jens Ådne Rydland


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Kaplan-Moss  
View profile  
 More options Nov 3, 9:05 am
From: Jacob Kaplan-Moss <ja...@jacobian.org>
Date: Tue, 3 Nov 2009 09:05:41 -0500
Local: Tues, Nov 3 2009 9:05 am
Subject: Re: Calling update() on EmptyQuerySet updates all rows in database
On Tue, Nov 3, 2009 at 7:42 AM, Jens Ådne Rydland <jensa...@pvv.ntnu.no> wrote:

> This seems to be caused by EmptyQuerySet not overriding update(),
> shouldn't this just return 0?

Yup, that's a bug. Can you please open a ticket so that we don't forget this?

Jacob


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google