summaryrefslogtreecommitdiff
path: root/django/contrib/auth/admin.py
diff options
context:
space:
mode:
authorNatalia <124304+nessita@users.noreply.github.com>2024-08-15 10:27:24 -0300
committernessita <124304+nessita@users.noreply.github.com>2024-08-19 12:39:57 -0300
commit0ebed5fa95f53b87383901bbd9341ef3c974344f (patch)
tree193097712f8f9ada595cb476a2d529e8abe920fe /django/contrib/auth/admin.py
parentb60fd8722f305ec29c87f34d3fea262e56394ebd (diff)
Fixed #35678 -- Removed "usable_password" field from BaseUserCreationForm.
Refs #34429: Following the implementation allowing the setting of unusable passwords via the admin site, the `BaseUserCreationForm` and `UserCreationForm` were extended to include a new field for choosing whether password-based authentication for the new user should be enabled or disabled at creation time. Given that these forms are designed to be extended when implementing custom user models, this branch ensures that this new field is moved to a new, admin-dedicated, user creation form `AdminUserCreationForm`. Regression in e626716c28b6286f8cf0f8174077f3d2244f3eb3. Thanks Simon Willison for the report, Fabian Braun and Sarah Boyce for the review.
Diffstat (limited to 'django/contrib/auth/admin.py')
-rw-r--r--django/contrib/auth/admin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
index 8e1d63ef07..e977d3ded5 100644
--- a/django/contrib/auth/admin.py
+++ b/django/contrib/auth/admin.py
@@ -5,8 +5,8 @@ from django.contrib.admin.utils import unquote
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.forms import (
AdminPasswordChangeForm,
+ AdminUserCreationForm,
UserChangeForm,
- UserCreationForm,
)
from django.contrib.auth.models import Group, User
from django.core.exceptions import PermissionDenied
@@ -71,7 +71,7 @@ class UserAdmin(admin.ModelAdmin):
),
)
form = UserChangeForm
- add_form = UserCreationForm
+ add_form = AdminUserCreationForm
change_password_form = AdminPasswordChangeForm
list_display = ("username", "email", "first_name", "last_name", "is_staff")
list_filter = ("is_staff", "is_superuser", "is_active", "groups")