Skip to content

Commit

Permalink
Document render_template() can take a Template, refs #1045
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Oct 24, 2020
1 parent a576acc commit c369711
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ This method lets you read plugin configuration values that were set in ``metadat
await .render_template(template, context=None, request=None)
------------------------------------------------------------

``template`` - string or list of strings
``template`` - string, list of strings or jinja2.Template
The template file to be rendered, e.g. ``my_plugin.html``. Datasette will search for this file first in the ``--template-dir=`` location, if it was specified - then in the plugin's bundled templates and finally in Datasette's set of default templates.

If this is a list of template file names then the first one that exists will be rendered.
If this is a list of template file names then the first one that exists will be loaded and rendered.

If this is a Jinja `Template object <https://jinja.palletsprojects.com/en/2.11.x/api/#jinja2.Template>`__ it will be used directly.

``context`` - None or a Python dictionary
The context variables to pass to the template.
Expand Down

0 comments on commit c369711

Please sign in to comment.