In my “root” template I have something like this
{% if special %}
some_special_html
{% endif %}
The special template var is inserted in template by certain views.
The problem is that I need the password_change view to allso set the special template var.
What’s best way to approach this?
Currently, the password_change view is called directly from urls.py:
url(r'^change_password/$', 'django.contrib.auth.views.password_change',
{'template_name': 'profile/password_change.html'},
name='password_change'),
As of at least Django 1.3, the
password_changeview does take extra context, although the documentation doesn’t mention it.You can pass extra keyword arguments to a view by using the
kwargsargument of theurlfunction, so to get the extra context in, do something like this: