Source

django-simplepagination / simplepagination / templatetags / paginator.py

from django.template import Library


register = Library()

@register.simple_tag
def page_link(page_number, params, anchor):
    link = '?page=%s' % page_number
    if params:
        link = '%s&%s' % (link, params.replace('&', '&'))
    if anchor:
        link += '#%s' % anchor
    return link