Ticket #7071: password_change_form.patch

File password_change_form.patch, 1.2 KB (added by rvanlaar, 6 years ago)

Improved patch and working patch

  • django/contrib/auth/views.py

     
    138138                                                                             {'login_url': settings.LOGIN_URL}))
    139139
    140140def password_change(request, template_name='registration/password_change_form.html',
    141                     post_change_redirect=None):
     141                    post_change_redirect=None,
     142                    change_password_form=PasswordChangeForm):
    142143    if post_change_redirect is None:
    143144        post_change_redirect = reverse('django.contrib.auth.views.password_change_done')
    144145    if request.method == "POST":
    145         form = PasswordChangeForm(request.user, request.POST)
     146        form = change_password_form(request.user, request.POST)
    146147        if form.is_valid():
    147148            form.save()
    148149            return HttpResponseRedirect(post_change_redirect)
    149150    else:
    150         form = PasswordChangeForm(request.user)
     151        form = change_password_form(request.user)
    151152    return render_to_response(template_name, {
    152153        'form': form,
    153154    }, context_instance=RequestContext(request))
Back to Top