Skip to content

Accept the same arguments as dict constructor for template rendering functions #5133

@MattyMay

Description

@MattyMay

The template rendering functions currently only accept named arguments to build the context dictionary passed to jinja2.Template.render(). While unpacking is easy enough, it would be nice to be able to use the same arguments as the dict constructor (like how Jinja's render function works).

Examples:

flask.render_template("index.html", {"greeting": "Hello", "name": "World"})
flask.render_template("index.html", {"greeting": "Hello"}, name="World")

I'll link a PR in case this is something people would like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions