From dadfca08c0db567ce33284aaa8eb388cf667a836 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 8 Nov 2006 04:50:01 +0000 Subject: 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 --- tests/modeltests/pagination/models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/modeltests') 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 """} -- cgit v1.3