e.g. something like this defined in settings
{{{#!python
INCLUSION_CONTEXT_VARIABLES = ['idempotency_key', ]
}}}
and a few lines added to the `render` method of `InclusionNode`
{{{#!python
def render(self, context):
...
csrf_token = context.get('csrf_token')
if csrf_token is not None:
new_context['csrf_token'] = csrf_token
for var in settings.INCLUSION_CONTEXT_VARIABLES:
value = context.get(var)
if value is not None:
new_context[var] = value
return t.render(new_context)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32429>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
Comment:
Thanks for this ticket, however creating a new setting is always
controversial and we don't want tag-specific settings. The `csrf_token` is
a special case (see #12095) to make CSRF protection to be as simple as
possible. You can always subclass `InclusionNode` and add a custom
decorator.
Feel-free to start a discussion on DevelopersMailingList if you don't
agree.
--
Ticket URL: <https://code.djangoproject.com/ticket/32429#comment:1>
Comment (by Michael Gisi):
Replying to [comment:1 Mariusz Felisiak]:
> Thanks for this ticket, however creating a new setting is always
controversial and we don't want tag-specific settings. The `csrf_token` is
a special case (see #12095) to make CSRF protection to be as simple as
possible. You can always subclass `InclusionNode` and add a custom
decorator.
>
> Feel-free to start a discussion on DevelopersMailingList if you don't
agree.
Understood - we will subclass `InclusionNode` to get the desired behavior.
Thanks for the quick response.
--
Ticket URL: <https://code.djangoproject.com/ticket/32429#comment:2>