summaryrefslogtreecommitdiff
path: root/tests/modeltests
diff options
context:
space:
mode:
authorRobin Munn <robin.munn@gmail.com>2006-11-08 04:50:01 +0000
committerRobin Munn <robin.munn@gmail.com>2006-11-08 04:50:01 +0000
commitdadfca08c0db567ce33284aaa8eb388cf667a836 (patch)
treeab7255eeee1bbe03d95652cc74a3843fa052d8ac /tests/modeltests
parent0b059aa4eadc1d95ceca3a32821b65a9fb2a53e8 (diff)
sqlalchemy: Merged revisions 3918 to 4053 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/sqlalchemy@4054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
-rw-r--r--tests/modeltests/pagination/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/modeltests/pagination/models.py b/tests/modeltests/pagination/models.py
index ea2385dc79..3319b5cafa 100644
--- a/tests/modeltests/pagination/models.py
+++ b/tests/modeltests/pagination/models.py
@@ -64,4 +64,17 @@ True
>>> paginator.last_on_page(1)
9
+# Add a few more records to test out the orphans feature.
+>>> for x in range(10, 13):
+... Article(headline="Article %s" % x, pub_date=datetime(2006, 10, 6)).save()
+
+# With orphans set to 3 and 10 items per page, we should get all 12 items on a single page:
+>>> paginator = ObjectPaginator(Article.objects.all(), 10, orphans=3)
+>>> paginator.pages
+1
+
+# With orphans only set to 1, we should get two pages:
+>>> paginator = ObjectPaginator(Article.objects.all(), 10, orphans=1)
+>>> paginator.pages
+2
"""}