diff --git a/amadeus/templates/pagination.html b/amadeus/templates/pagination.html new file mode 100644 index 0000000..982bb66 --- /dev/null +++ b/amadeus/templates/pagination.html @@ -0,0 +1,11 @@ +
+
+ +
+
\ No newline at end of file diff --git a/amadeus/templatetags/__init__.py b/amadeus/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/amadeus/templatetags/__init__.py diff --git a/amadeus/templatetags/pagination.py b/amadeus/templatetags/pagination.py new file mode 100644 index 0000000..7b16a8e --- /dev/null +++ b/amadeus/templatetags/pagination.py @@ -0,0 +1,21 @@ +from django import template + +register = template.Library() + +@register.inclusion_tag('pagination.html') +def pagination(request, paginator, page_obj): + context = { + 'request': request, + 'paginator': paginator, + 'page_obj': page_obj, + } + + getvars = request.GET.copy() + + if 'page' in getvars: + del getvars['page'] + + if len(getvars) > 0: + context['getvars'] = '&%s' % getvars.urlencode() + + return context \ No newline at end of file diff --git a/users/templates/users/list.html b/users/templates/users/list.html index 8179496..2cc93d2 100644 --- a/users/templates/users/list.html +++ b/users/templates/users/list.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} -{% load i18n django_bootstrap_breadcrumbs permission_tags static %} +{% load i18n pagination django_bootstrap_breadcrumbs permission_tags static %} {% block breadcrumbs %} {{ block.super }} @@ -21,18 +21,26 @@ {% endfor %} {% endif %} -
-
-
- -
-
- -
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ - +
{% if users %} {% for acc in users %} @@ -57,6 +65,7 @@
{% endfor %} + {% pagination request paginator page_obj %} {% else %}
-- libgit2 0.21.2