summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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
"""}