1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #36121 -- Allowed customizing the admin site password change form.

This commit is contained in:
Mohammadreza Eskandari
2025-01-21 12:34:35 +03:00
committed by Sarah Boyce
parent c6ace896a2
commit 12b9ef38b3
6 changed files with 24 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.admin.forms import AdminAuthenticationForm, AdminPasswordChangeForm
from django.contrib.admin.helpers import ActionForm
from django.core.exceptions import ValidationError
@@ -14,6 +14,12 @@ class CustomAdminAuthenticationForm(AdminAuthenticationForm):
return username
class CustomAdminPasswordChangeForm(AdminPasswordChangeForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["old_password"].label = "Custom old password label"
class MediaActionForm(ActionForm):
class Media:
js = ["path/to/media.js"]