1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #34883 -- Allowed template tags to set extra data on templates.

By setting a value in the `parser.extra_data` mapping, template tags
pass additional data out of the parsing context.

Any extra data set is exposed on the template via the matching
`.extra_data` attribute.

Library authors should use a key to namespace extra data. The 'django'
namespace is reserved for internal use.
This commit is contained in:
Carlton Gibson
2023-09-29 19:02:19 +02:00
committed by Mariusz Felisiak
parent f4e72e6523
commit 35bbb2c9c0
4 changed files with 28 additions and 2 deletions

View File

@@ -194,7 +194,9 @@ Signals
Templates
~~~~~~~~~
* ...
* Custom tags may now set extra data on the ``Parser`` object that will later
be made available on the ``Template`` instance. Such data may be used, for
example, by the template loader, or other template clients.
Tests
~~~~~