Reputation: 236
I have this in my django project:
path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(template_name='password_change_done.html'),
name='password_change_done'),
path('password_change/', auth_views.PasswordChangeView.as_view(template_name='password_change.html'),
name='password_change'),
in these html pages for the above urls I have to pass some information too as context. So how do I pass context in such type of urls which have no custom view
Upvotes: 1
Views: 411
Reputation: 2273
You can use the extra_context
argument of the as_view
function as defined in the documention.
Example :
path(
'password_change/',
auth_views.PasswordChangeView.as_view(
template_name='password_change.html',
extra_context={'foo': 'bar'}
),
name='password_change'
),
Then you can use {{ foo }}
in your template.
Upvotes: 4