The code for rendering pagination controls in my app is the same everywhere:
{% if is_paginated %}
<div class="row">
<div class="col xs-12">
{% if page_obj.has_previous %}
<a class="btn btn-primary" href="foo/?page={{ page_obj.previous_page_number }}">Previous</a>
{% endif %}
{% if page_obj.has_next %}
<a class="btn btn-primary"
href="foo/?page={{ page_obj.next_page_number }}">Previous</a>
{% endif %}
</div>
</div>
{% endif %}
So I'm wondering whether there's a good w&ay to create the href for the previous and next buttons based on the current url. I can't just take the current url and append "?page=..." to it, since the url may already have a "page" parameter and/or other querystring parameters. On stackoverflow, I've seen people create a replace_url_parameter template tag, which replaces the given parameter by parsing the url, changing the param, and rebuilding the url again. I can do this, but this seems like such a common task that I'm surprised I can't find any tools to do this in django itself.
If there's an open source project that offers this, I might be interested, but I'm not sure if I want to take on an extra dependency just for pagination urls.