diff options
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/pagination/templatetags/pagination_tags.py | 6 | ||||
-rw-r--r-- | app/lib/pagination/tests.py | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/lib/pagination/templatetags/pagination_tags.py b/app/lib/pagination/templatetags/pagination_tags.py index ef9bf5e..dd47009 100644 --- a/app/lib/pagination/templatetags/pagination_tags.py +++ b/app/lib/pagination/templatetags/pagination_tags.py @@ -218,8 +218,10 @@ def paginate(context, window=DEFAULT_WINDOW): if 'use_page_path' in context: to_return['request'] = context['request'] to_return['use_page_path'] = context['use_page_path'] - to_return['prev_page'] = page_obj.previous_page_number() - to_return['next_page'] = page_obj.next_page_number() + if page_obj.has_previous(): + to_return['prev_page'] = page_obj.previous_page_number() + if page_obj.has_next(): + to_return['next_page'] = page_obj.next_page_number() getvars = context['request'].GET.copy() if 'page' in getvars: diff --git a/app/lib/pagination/tests.py b/app/lib/pagination/tests.py index 837e55c..ba55c03 100644 --- a/app/lib/pagination/tests.py +++ b/app/lib/pagination/tests.py @@ -49,4 +49,4 @@ u'\\n<div class="pagination">... >>> t.render(Context({'var': range(21), 'request': RequestProxy()})) u'\\n<div class="pagination">... >>> -"""
\ No newline at end of file +""" |