mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Changed all model unit tests to use __str__() instead of __repr__(). Also slightly changed related-object DoesNotExist exception message to use repr instead of str
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
55e453a09c
commit
a5b7c29816
28 changed files with 341 additions and 336 deletions
|
@ -12,7 +12,7 @@ class Article(models.Model):
|
|||
headline = models.CharField(maxlength=100, default='Default headline')
|
||||
pub_date = models.DateTimeField()
|
||||
|
||||
def __repr__(self):
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
||||
API_TESTS = """
|
||||
|
@ -35,11 +35,11 @@ API_TESTS = """
|
|||
|
||||
# get the first page (zero-based)
|
||||
>>> paginator.get_page(0)
|
||||
[Article 1, Article 2, Article 3, Article 4, Article 5]
|
||||
[<Article: Article 1>, <Article: Article 2>, <Article: Article 3>, <Article: Article 4>, <Article: Article 5>]
|
||||
|
||||
# get the second page
|
||||
>>> paginator.get_page(1)
|
||||
[Article 6, Article 7, Article 8, Article 9]
|
||||
[<Article: Article 6>, <Article: Article 7>, <Article: Article 8>, <Article: Article 9>]
|
||||
|
||||
# does the first page have a next or previous page?
|
||||
>>> paginator.has_next_page(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue