diff --git a/gas/templates/gas/tags/pagination.html b/gas/templates/gas/tags/pagination.html new file mode 100644 index 0000000..e335fce --- /dev/null +++ b/gas/templates/gas/tags/pagination.html @@ -0,0 +1,28 @@ +{% load i18n %} +{% load custom_gas_tags %} + +{% if page %} + +{% endif %} diff --git a/gas/templatetags/gas_tags.py b/gas/templatetags/gas_tags.py index 4d95a80..b69527e 100644 --- a/gas/templatetags/gas_tags.py +++ b/gas/templatetags/gas_tags.py @@ -1,5 +1,6 @@ -# -*- coding: utf-8 -*- import datetime +import json +from urllib.parse import urlencode from django import template from django.utils.html import mark_safe @@ -39,3 +40,23 @@ def display_boolean(value): else: render = '' return mark_safe(render) + + +@register.simple_tag +def url_replace(request, **kwargs): + query = request.GET.dict() + query.update(kwargs) + return urlencode(query) + + +@register.inclusion_tag("gas/tags/pagination.html") +def pagination(request, page): + return { + 'request': request, + 'page': page, + } + + +@register.filter +def to_json(data): + return mark_safe(json.dumps(data))