Skip to contentSkip to conversation

patchwork: keep archive query parameter in views

PATCH New Jose Lamego 1 participant 3 messages Mar 27, 2017

lore
Share & tools
lore
#0 lore raw

cover patchwork: keep archive query parameter in views

patchwork pagination links do not keep "archive" filtering parameter, which may lead to inaccurate data displayed in the next views.

These changes read the "archive" parameter from current GET request and add it to the pagination links.

[YOCTO #11200]

Jose Lamego (2):
patchwork/paginator.py: Add archive parameter
pagination.html: Add archive parameter to links

 patchwork/paginator.py                        |  1 +
 patchwork/templates/patchwork/pagination.html | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 patchwork/paginator.py: Add archive parameter

paginator links do not keep "archive" filtering parameter from current view, which may lead to inaccurate data displayed in the next views.

This change adds the "archive" parameter read from the current request to the paginator class.

[YOCTO #11200]

---
 patchwork/paginator.py | 1 +
 1 file changed, 1 insertion(+)
patchwork/paginator.py +1 -0
index 0f6d684..88fca29 100644
@@ -93,3 +93,4 @@ class Paginator(paginator.Paginator):
         self.leading_set.reverse()
         self.long_page = len(
             self.current_page.object_list) >= LONG_PAGE_THRESHOLD
+        self.archive = request.GET.get("archive")
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 pagination.html: Add archive parameter to links

In reply to Jose Lamego

paginator links do not include current "archive" status parameter, which may lead to inaccurate data displayed in next views.

This change includes "archive" parameter from the paginator class to all of the pagination links.

[YOCTO #11200]

---
 patchwork/templates/patchwork/pagination.html | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
patchwork/templates/patchwork/pagination.html +5 -5
index b8b76b3..e4f802b 100644
@@ -4,7 +4,7 @@
 <div class="paginator">
 {% if page.has_previous %}
  <span class="prev">
-  <a href="{% listurl page=page.previous_page_number %}"
+  <a href="{% listurl page=page.previous_page_number,archive=page.paginator.archive %}"
      title="Previous Page">&laquo;</a></span>
 {% else %}
  <span class="prev-na">&laquo;</span>
@@ -12,7 +12,7 @@
  
 {% if page.paginator.trailing_set %}
  {% for p in page.paginator.trailing_set %}
- <span class="page"><a href="{% listurl page=p %}" >{{ p }}</a></span>
+ <span class="page"><a href="{% listurl page=p,archive=page.paginator.archive %}" >{{ p }}</a></span>
  {% endfor %}
         ...
 {% endif %}
@@ -21,7 +21,7 @@
   {% ifequal p page.number %}
     <span class="curr" title="Current Page">{{ p }}</span>
   {% else %}
-    <span class="page"><a href="{% listurl page=p %}"
+    <span class="page"><a href="{% listurl page=p,archive=page.paginator.archive %}"
      title="Page {{ p }}">{{ p }}</a></span>
   {% endifequal %}
 {% endfor %}
@@ -29,13 +29,13 @@
 {% if page.paginator.leading_set %}
         …
  {% for p in page.paginator.leading_set %}
-    <span class="page"><a href="{% listurl page=p %}">{{ p }}</a></span>
+    <span class="page"><a href="{% listurl page=p,archive=page.paginator.archive %}">{{ p }}</a></span>
  {% endfor %}
 {% endif %}
  
 {% if page.has_next %}
  <span class="next">
-  <a href="{% listurl page=page.next_page_number %}"
+  <a href="{% listurl page=page.next_page_number,archive=page.paginator.archive %}"
    title="Next Page">&raquo;</a>
   </span>
 {% else %}
Signature · 1 line
2.7.4