From 9a2ea2be2be5158be3b57a2f752c4e49bf1b151d Mon Sep 17 00:00:00 2001 From: Timon Engelke Date: Sat, 5 Dec 2020 16:06:14 +0100 Subject: [PATCH] Annotation Management: keep filter for next pages --- .../templates/annotations/manage_annotations.html | 9 +++++---- .../imagetagger/annotations/templatetags/__init__.py | 0 .../annotations/templatetags/update_query.py | 11 +++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 imagetagger/imagetagger/annotations/templatetags/__init__.py create mode 100644 imagetagger/imagetagger/annotations/templatetags/update_query.py diff --git a/imagetagger/imagetagger/annotations/templates/annotations/manage_annotations.html b/imagetagger/imagetagger/annotations/templates/annotations/manage_annotations.html index d963a394..fa282577 100644 --- a/imagetagger/imagetagger/annotations/templates/annotations/manage_annotations.html +++ b/imagetagger/imagetagger/annotations/templates/annotations/manage_annotations.html @@ -1,5 +1,6 @@ {% extends 'base/base.html' %} {% load static %} +{% load update_query %} {% block navblock %}
  • Imageset
  • {% endblock %} @@ -98,8 +99,8 @@

    {% if annotations.has_previous %} - « first - previous + « first + previous {% endif %} {% if annotations.has_other_pages %} @@ -107,8 +108,8 @@

    {% endif %} {% if annotations.has_next %} - next - last » + next + last » {% endif %}

    diff --git a/imagetagger/imagetagger/annotations/templatetags/__init__.py b/imagetagger/imagetagger/annotations/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/imagetagger/imagetagger/annotations/templatetags/update_query.py b/imagetagger/imagetagger/annotations/templatetags/update_query.py new file mode 100644 index 00000000..e1fbc2c9 --- /dev/null +++ b/imagetagger/imagetagger/annotations/templatetags/update_query.py @@ -0,0 +1,11 @@ +from django import template + +register = template.Library() + + +@register.simple_tag(takes_context=True) +def update_query(context, **kwargs): + query = context['request'].GET.copy() + for k, v in kwargs.items(): + query[k] = v + return query.urlencode()