[Answer]-Custom tag for pagination

1👍

Use simple tags. For example:

@register.simple_tag
def pagetag(page):
    return '/?page=' + page

Then, in your view, make sure to use {{ }} instead of {% %}:

<li><a href="{{ pagetag page }}">{{page}}</a></li>

Note: It’s not recommended to use a different tag just for prepending a simple string. Just do it like in the documentation.

Leave a comment