I haven't set a custom manager as far as I'm aware. Here is what happens to
me:
>>> from cube.books.models import Book
>>> no_books = Book.objects.none()
>>> Book.objects.all().count()
1667
>>> Book.objects.filter(status='O').count()
1
>>> no_books.update(status='O')
1667
>>> Book.objects.filter(status='O').count()
1667
>>>
and here is my model
class Book(models.Model):
"""
For when a student lists a particular copy of a book.
Keeps track of
* when and who listed (is selling) it
* if and who is currently holding it
* when it was last put on hold
* when it finally got sold
* whether the book is flagged for deletion or not
"""
STATUS_CHOICES = (
(u'F', u'For Sale'),
(u'M', u'Missing'),
(u'O', u'On Hold'),
(u'P', u'Seller Paid'),
(u'S', u'Sold'),
(u'D', u'Deleted'),
(u'T', u'To Be Deleted'),
)
metabook = models.ForeignKey(MetaBook)
list_date = models.DateTimeField('Date Listed', default=datetime.now)
seller = models.ForeignKey(User, related_name="selling")
sell_date = models.DateTimeField('Date Sold', blank=True, null=True)
holder = models.ForeignKey(User, related_name="holding",
blank=True, null=True)
hold_date = models.DateTimeField('Date Held', blank=True, null=True)
price = models.DecimalField(max_digits=7, decimal_places=2)
status = models.CharField(max_length=1, choices=STATUS_CHOICES,
default='F')
is_legacy = models.BooleanField(default=False)
def __unicode__(self):
return "%s listed by %s on %s" % (self.metabook, self.seller,
self.list_date.date())
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.