## https://github.com/mbr/flask-bootstrap/blob/master/flask_bootstrap/templates/bootstrap/pagination.html {% macro _arg_url_for(endpoint, base) %} {# calls url_for() with a given endpoint and **base as the parameters, additionally passing on all keyword_arguments (may overwrite existing ones) #} {%- with kargs = base.copy() -%} {%- do kargs.update(kwargs) -%} {{url_for(endpoint, **kargs)}} {%- endwith %} {%- endmacro %} {% macro render_pagination(pagination, endpoint=None, prev=('«')|safe, next=('»')|safe, size=None, ellipses='…', args={} ) -%} {% with url_args = {} %} {%- do url_args.update(request.view_args if not endpoint else {}), url_args.update(request.args if not endpoint else {}), url_args.update(args) -%} {% with endpoint = endpoint or request.endpoint %} {% endwith %} {% endwith %} {% endmacro %}