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.
Source:stackexchange.com