Small formatting changes to model unit tests to make them look better in the model examples online

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-05-31 19:10:43 +00:00
parent 3daae59aab
commit a846155118
5 changed files with 19 additions and 18 deletions

View file

@ -1,21 +1,20 @@
"""
20. Object Pagination
Django provides a framework for paginating a list of objects in a few.
This is often useful for dividing search results or long lists of objects
in to easily readable pages.
28. Object pagination
Django provides a framework for paginating a list of objects in a few lines
of code. This is often useful for dividing search results or long lists of
objects into easily readable pages.
"""
from django.db import models
class Article(models.Model):
headline = models.CharField(maxlength=100, default='Default headline')
pub_date = models.DateTimeField()
def __repr__(self):
return self.headline
return self.headline
API_TESTS = """
# prepare a list of objects for pagination
>>> from datetime import datetime
@ -34,8 +33,8 @@ API_TESTS = """
>>> paginator.pages
2
# get the first page (zero-based)
>>> paginator.get_page(0)
# get the first page (zero-based)
>>> paginator.get_page(0)
[Article 1, Article 2, Article 3, Article 4, Article 5]
# get the second page
@ -45,7 +44,7 @@ API_TESTS = """
# does the first page have a next or previous page?
>>> paginator.has_next_page(0)
True
>>> paginator.has_previous_page(0)
False
@ -55,5 +54,5 @@ False
>>> paginator.has_previous_page(1)
True
"""