Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Created May 14, 2013 14:14
Show Gist options
  • Save mitsuhiko/5576231 to your computer and use it in GitHub Desktop.
Save mitsuhiko/5576231 to your computer and use it in GitHub Desktop.
from flask import request, url_for
def modified_url(**new_args):
args = request.view_args.copy()
args.update(new_args)
return url_for(request.endpoint, **args)
app.jinja_env.globals['modified_url'] = modified_url
<a href="{{ modified_url(page=2) }}">link to page 2</a>
@efazati
Copy link

efazati commented May 14, 2013

not work for current gets

 args = request.args.copy()

can be okey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment