mirror of
https://github.com/simonw/datasette.git
synced 2026-06-24 09:44:36 +02:00
Warn plugin authors to avoid name conflicts with extra_template_vars
Closes #1988
This commit is contained in:
parent
e0cdd38786
commit
e3ff63b0f9
1 changed files with 4 additions and 0 deletions
|
|
@ -230,6 +230,10 @@ Function that returns an awaitable function that returns a dictionary
|
|||
|
||||
Datasette runs Jinja2 in `async mode <https://jinja.palletsprojects.com/en/2.10.x/api/#async-support>`__, which means you can add awaitable functions to the template scope and they will be automatically awaited when they are rendered by the template.
|
||||
|
||||
.. warning::
|
||||
|
||||
Be careful not to accidentally define a variable that conflicts with one that Datasette is already using for something else. Check :ref:`the template context documentation <template_context>` to see the variables defined by Datasette core.
|
||||
|
||||
Here's an example plugin that adds a ``"user_agent"`` variable to the template context containing the current request's User-Agent header:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue