我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用django.contrib.auth.views.password_reset_done()。
def post(self, request): email = request.POST['email'] # NOTE this does not provide the email address yet, since it seems like there # is a bug in django (at least imo). The path with HttpResponseRedirect omits the extra_context-field # s.a. http://python.6.x6.nabble.com/Django-24944-Have-password-reset-pass-extra- # context-to-the-email-template-rendering-as-well-td5097076.html # TODO did I mean url instead of email address? return password_reset(request, template_name='registration/password_reset_form.html', post_reset_redirect='password_reset_done', extra_context={'email': email}) # TODO BUG does it work as intended again?
def get(self, request): # TODO unfortunately the extra_context is omitted and not provided return password_reset_done(request, 'registration/password_reset_done.html')
def post(self, request): return password_reset_done(request, 'registration/password_reset_done.html')