diff --git a/django/core/paginator.py b/django/core/paginator.py index b50ca826c4..71a5479fd5 100644 --- a/django/core/paginator.py +++ b/django/core/paginator.py @@ -91,7 +91,7 @@ class ObjectPaginator(object): a template for loop. """ if self._page_range is None: - self._page_range = range(1, self._pages + 1) + self._page_range = range(1, self.pages + 1) return self._page_range hits = property(_get_hits) diff --git a/tests/modeltests/pagination/models.py b/tests/modeltests/pagination/models.py index 1dcec00a32..f44c67a139 100644 --- a/tests/modeltests/pagination/models.py +++ b/tests/modeltests/pagination/models.py @@ -78,7 +78,8 @@ True >>> paginator.pages 2 -# The paginator can provide a list of all available pages +# The paginator can provide a list of all available pages. +>>> paginator = ObjectPaginator(Article.objects.all(), 10) >>> paginator.page_range [1, 2] """}