If you look at the sources of django.contrib.auth.views.password_reset , you will see that it uses RequestContext . As a result, you can use Context Processors to change the context, which can allow you to enter the information you need.
The b-list has a good view for context processors .
Edit (I seem to have been confused by what was actually):
You will notice that password_reset accepts a named parameter named template_name :
def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html', password_reset_form=PasswordResetForm, token_generator=default_token_generator, post_reset_redirect=None):
Learn more about password_reset .
... this way with urls.py like:
from django.conf.urls.defaults import * from django.contrib.auth.views import password_reset urlpatterns = patterns('', (r'^/accounts/password/reset/$', password_reset, {'template_name': 'my_templates/password_reset.html'}), ... )
django.contrib.auth.views.password_reset will be called for URLs matching '/accounts/password/reset' with the keyword argument template_name = 'my_templates/password_reset.html' .
Otherwise, you do not need to provide any context since the password_reset view takes care of itself. If you want to know what context you have, you can throw a TemplateSyntax error and look at the stack trace to find a frame with a local variable called context . If you want to change the context, then what I said above about context handlers is probably the way to go.
In short: what do you need to do to use your own template? Provide the keyword argument template_name to represent when invoked. You can put keyword arguments in views by including the dictionary as the third term in the tuple of URL patterns.
Aaron Maenpaa Dec 23 '08 at 13:21 2008-12-23 13:21
source share