django-filter use paginations

This worked for me:

in my template instead of using this

<li><a href="https://stackoverflow.com/questions/44048156/?page={{ i }}">{{ i }}</a></li>

I wrote this:

{% if 'whatever_parameter_you_use_to_filter' in request.get_full_path %}
   <li><a href="https://stackoverflow.com/questions/44048156/{{ request.get_full_path }}&page={{ i }}"{{ i }}</a></li>
{% else %}
   <li><a href="https://stackoverflow.com/questions/44048156/?page={{ i }}">{{ i }}</a></li>
{% endif %}

I hope it helps 🙂

Leave a Comment