summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Yves Chibon <pingou@pingoured.fr>2012-04-05 23:59:34 +0200
committerPierre-Yves Chibon <pingou@pingoured.fr>2012-04-05 23:59:34 +0200
commitd60f8c3cc4bd6b35f4f821fd38e24a8190f1e993 (patch)
tree3414e9d59cdae498a44ec9e6dc89a6c55d17cadf
parent140b01b87776d6f97b1da335ef86bfca94452fc7 (diff)
downloadhyperkitty-d60f8c3cc4bd6b35f4f821fd38e24a8190f1e993.tar.gz
hyperkitty-d60f8c3cc4bd6b35f4f821fd38e24a8190f1e993.tar.xz
hyperkitty-d60f8c3cc4bd6b35f4f821fd38e24a8190f1e993.zip
Fix the previous/next link used in the pagination
-rw-r--r--templates/search.html5
-rw-r--r--templatetags/poll_extras.py12
2 files changed, 15 insertions, 2 deletions
diff --git a/templates/search.html b/templates/search.html
index 5e8f847..36fbc1d 100644
--- a/templates/search.html
+++ b/templates/search.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load poll_extras %}
{% block title %}{{ app_name }}{% endblock %}
@@ -21,7 +22,7 @@
<div class="pagination">
<span class="step-links">
{% if threads.has_previous %}
- <a href="{{ threads.previous_page_number }}">previous</a>
+ <a href="{{full_path|strip_page}}/{{ threads.previous_page_number }}">previous</a>
{% endif %}
<span class="current">
@@ -29,7 +30,7 @@
</span>
{% if threads.has_next %}
- <a href="{{ threads.next_page_number }}">next</a>
+ <a href="{{full_path|strip_page}}/{{ threads.next_page_number }}">next</a>
{% endif %}
</span>
</div>
diff --git a/templatetags/poll_extras.py b/templatetags/poll_extras.py
index f57a4a7..86d8112 100644
--- a/templatetags/poll_extras.py
+++ b/templatetags/poll_extras.py
@@ -1,4 +1,5 @@
from django import template
+from django.http import HttpRequest
from django.utils.datastructures import SortedDict
register = template.Library()
@@ -29,3 +30,14 @@ def to_month(value):
months = ('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December')
return months[value -1]
+
+@register.filter(name="strip_page")
+def strip_page(value):
+ print repr(value)
+ if not value:
+ return value
+ if value.endswith('/'):
+ output = value.rsplit('/', 2)
+ else:
+ output = value.rsplit('/', 1)
+ return output[0]