Ticket #10202: count-0.diff

File count-0.diff, 949 bytes (added by Alex Gaynor, 16 years ago)
  • django/db/models/sql/query.py

    diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
    index bf664c6..903632e 100644
    a b class BaseQuery(object):  
    332332        # in SQL (in variants that provide them) doesn't change the COUNT
    333333        # output.
    334334        number = max(0, number - self.low_mark)
    335         if self.high_mark:
     335        if self.high_mark is not None:
    336336            number = min(number, self.high_mark - self.low_mark)
    337337
    338338        return number
  • tests/modeltests/lookup/models.py

    diff --git a/tests/modeltests/lookup/models.py b/tests/modeltests/lookup/models.py
    index 11e2b07..4655492 100644
    a b Article 4  
    80806L
    8181>>> articles[10:100].count()
    82820
     83>>> articles[:0].count()
     840
    8385
    8486# Date and date/time lookups can also be done with strings.
    8587>>> Article.objects.filter(pub_date__exact='2005-07-27 00:00:00').count()
Back to Top