patchwork: keep archive query parameter in views
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
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
@@ -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
PATCH 2/2 pagination.html: Add archive parameter to links
In reply to Jose Lamegopaginator 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
@@ -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">«</a></span> {% else %} <span class="prev-na">«</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">»</a> </span> {% else %}
Signature · 1 line
2.7.4