summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-12 00:16:17 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-12 00:16:17 +0000
commitd123588184dfecc286e8e06e16dc0383f435c051 (patch)
tree14dc2f8fc72a2ba15e49b3cb1f0345e1d64967b2 /tests
parent80e58b3211ae54754b734a409d5b944117d7963d (diff)
#fixed #2256 -- Made count() interact with slicing on QuerySets. Patch from
SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/lookup/models.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/modeltests/lookup/models.py b/tests/modeltests/lookup/models.py
index d344710bef..106c97d3b4 100644
--- a/tests/modeltests/lookup/models.py
+++ b/tests/modeltests/lookup/models.py
@@ -58,6 +58,17 @@ Article 4
>>> Article.objects.filter(headline__startswith='Blah blah').count()
0L
+# count() should respect sliced query sets.
+>>> articles = Article.objects.all()
+>>> articles.count()
+7L
+>>> articles[:4].count()
+4
+>>> articles[1:100].count()
+6L
+>>> articles[10:100].count()
+0
+
# Date and date/time lookups can also be done with strings.
>>> Article.objects.filter(pub_date__exact='2005-07-27 00:00:00').count()
3L