diff --git a/useradmin/admin.py b/useradmin/admin.py index fb680a83..f4cf1ddd 100644 --- a/useradmin/admin.py +++ b/useradmin/admin.py @@ -1,10 +1,16 @@ -from django.contrib.admin.sites import AdminSite +from django.contrib import admin -class UserAdmin(AdminSite): +class UserAdmin(admin.sites.AdminSite): def has_permission(self, request): """This admin site doesn't require being staff""" return request.user.is_active +class ModelUserAdmin(admin.ModelAdmin): + # Display actions on changelist bottom bu default + actions_on_bottom = True + + +# Defines new management site user_admin_site = UserAdmin(name='user_admin') diff --git a/users/admin.py b/users/admin.py index c48f0bb3..982db208 100644 --- a/users/admin.py +++ b/users/admin.py @@ -32,8 +32,7 @@ from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from reversion.admin import VersionAdmin -from useradmin.admin import user_admin_site - +from useradmin.admin import ModelUserAdmin, user_admin_site from .models import ( User, EMailAddress, @@ -85,10 +84,9 @@ class LdapServiceUserGroupAdmin(admin.ModelAdmin): search_fields = ('name',) -class SchoolAdmin(VersionAdmin): +class SchoolAdmin(VersionAdmin, ModelUserAdmin): """Administration, gestion des écoles""" list_display = ('name',) - actions_on_bottom = True class ListRightAdmin(VersionAdmin): @@ -97,10 +95,9 @@ class ListRightAdmin(VersionAdmin): list_display = ('unix_name',) -class ListShellAdmin(VersionAdmin): +class ListShellAdmin(VersionAdmin, ModelUserAdmin): """Gestion de la liste des shells coté admin""" list_display = ('shell',) - actions_on_bottom = True class RequestAdmin(admin.ModelAdmin):