From: Carl Meyer <carl@oddbird.net>
Date: Wed, 3 Mar 2010 21:27:40 +0000 (+0800)
Subject: added optional hashtag param to {% paginate %}
X-Git-Tag: 1.0.6~1^2
X-Git-Url: https://git.mdrn.pl/django-pagination.git/commitdiff_plain/0fbf41d323bb6558f9f103d16f1988e281f10721?ds=sidebyside;hp=1c414c8ed010359597b05dad1b41b65aeddfd1d7

added optional hashtag param to {% paginate %}
---

diff --git a/pagination/templates/pagination/pagination.html b/pagination/templates/pagination/pagination.html
index 37cef40..d5a94b8 100644
--- a/pagination/templates/pagination/pagination.html
+++ b/pagination/templates/pagination/pagination.html
@@ -11,7 +11,7 @@
             {% ifequal page page_obj.number %}
                 <span class="current page">{{ page }}</span>
             {% else %}
-                <a href="?page={{ page }}{{ getvars }}" class="page">{{ page }}</a>
+                <a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page">{{ page }}</a>
             {% endifequal %}
         {% else %}
             ...
diff --git a/pagination/templatetags/pagination_tags.py b/pagination/templatetags/pagination_tags.py
index fa87b37..fa8fd48 100644
--- a/pagination/templatetags/pagination_tags.py
+++ b/pagination/templatetags/pagination_tags.py
@@ -104,7 +104,7 @@ class AutoPaginateNode(template.Node):
         context['page_obj'] = page_obj
         return u''
 
-def paginate(context, window=DEFAULT_WINDOW):
+def paginate(context, window=DEFAULT_WINDOW, hashtag=None):
     """
     Renders the ``pagination/pagination.html`` template, resulting in a
     Digg-like display of the available pages, given the current page.  If there
@@ -209,6 +209,7 @@ def paginate(context, window=DEFAULT_WINDOW):
             'records': records,
             'page_obj': page_obj,
             'paginator': paginator,
+            'hashtag': hashtag,
             'is_paginated': paginator.count > paginator.per_page,
         }
         if 'request' in context: