MCPcopy
hub / github.com/django/django / password_change

Method password_change

django/contrib/admin/sites.py:351–367  ·  view source on GitHub ↗

Handle the "change password" task -- both form display and validation.

(self, request, extra_context=None)

Source from the content-addressed store, hash-verified

349 }
350
351 def password_change(self, request, extra_context=None):
352 """
353 Handle the "change password" task -- both form display and validation.
354 """
355 from django.contrib.admin.forms import AdminPasswordChangeForm
356 from django.contrib.auth.views import PasswordChangeView
357
358 url = reverse("admin:password_change_done", current_app=self.name)
359 defaults = {
360 "form_class": self.password_change_form or AdminPasswordChangeForm,
361 "success_url": url,
362 "extra_context": {**self.each_context(request), **(extra_context or {})},
363 }
364 if self.password_change_template is not None:
365 defaults["template_name"] = self.password_change_template
366 request.current_app = self.name
367 return PasswordChangeView.as_view(**defaults)(request)
368
369 def password_change_done(self, request, extra_context=None):
370 """

Callers

nothing calls this directly

Calls 3

each_contextMethod · 0.95
reverseFunction · 0.90
as_viewMethod · 0.45

Tested by

no test coverage detected