From 166e0490d39f619928ee9c5133cc5cab0ae5c1db Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 8 Dec 2015 14:40:55 -0500 Subject: [PATCH] Fixed #25895 -- Used a consistent style for UserAdmin overrides. Thanks Justin Abrahms for the report. --- docs/releases/1.10.txt | 6 +++--- docs/topics/auth/customizing.txt | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 64fb7921f9..932d53b029 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -323,14 +323,14 @@ when creating a user or changing usernames:: If you wish to keep this restriction in the admin, set ``UserAdmin.add_form`` to use this form:: - from django.contrib.auth.admin import UserAdmin + from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.models import User - class MyUserAdmin(UserAdmin): + class UserAdmin(BaseUserAdmin): add_form = MyUserCreationForm admin.site.unregister(User) - admin.site.register(User, MyUserAdmin) + admin.site.register(User, UserAdmin) Miscellaneous ~~~~~~~~~~~~~ diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 837bbf8fdd..3da3cc6970 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -326,7 +326,7 @@ add it to a ``UserAdmin`` class which is registered with the :class:`~django.contrib.auth.models.User` class:: from django.contrib import admin - from django.contrib.auth.admin import UserAdmin + from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.models import User from my_user_profile_app.models import Employee @@ -339,7 +339,7 @@ add it to a ``UserAdmin`` class which is registered with the verbose_name_plural = 'employee' # Define a new User admin - class UserAdmin(UserAdmin): + class UserAdmin(BaseUserAdmin): inlines = (EmployeeInline, ) # Re-register UserAdmin @@ -1059,7 +1059,7 @@ code would be required in the app's ``admin.py`` file:: from django import forms from django.contrib import admin from django.contrib.auth.models import Group - from django.contrib.auth.admin import UserAdmin + from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField from customauth.models import MyUser @@ -1110,7 +1110,7 @@ code would be required in the app's ``admin.py`` file:: return self.initial["password"] - class MyUserAdmin(UserAdmin): + class UserAdmin(BaseUserAdmin): # The forms to add and change user instances form = UserChangeForm add_form = UserCreationForm @@ -1138,7 +1138,7 @@ code would be required in the app's ``admin.py`` file:: filter_horizontal = () # Now register the new UserAdmin... - admin.site.register(MyUser, MyUserAdmin) + admin.site.register(MyUser, UserAdmin) # ... and, since we're not using Django's built-in permissions, # unregister the Group model from admin. admin.site.unregister(Group)