Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Created July 11, 2012 17:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mitsuhiko/3091909 to your computer and use it in GitHub Desktop.
Save mitsuhiko/3091909 to your computer and use it in GitHub Desktop.
from flask import request, url_for
def url_for_here(**changed_args):
args = request.args_args.copy()
args.update(request.view_args)
args.update(changed_args)
return url_for(request.endpoint, **args)
app.jinja_env.globals['url_for_here'] = url_for_here
<a href="{{ url_for_here(page=42) }}">page 42</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment