34 lines
1 KiB
Python
34 lines
1 KiB
Python
from django.contrib import admin
|
|
from django.contrib.admin import AdminSite
|
|
from django.contrib.sites.admin import SiteAdmin
|
|
from django.contrib.sites.models import Site
|
|
|
|
from django.contrib.auth import get_user_model
|
|
from django.contrib.auth.models import Group
|
|
from django.contrib.auth.admin import UserAdmin, GroupAdmin
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
class CustomAdminSite(AdminSite):
|
|
site_header = "Administration du Poulpe"
|
|
site_title = "Poulpe"
|
|
index_title = "Administration"
|
|
|
|
def index(self, request, extra_context=None):
|
|
if extra_context is None:
|
|
extra_context = {}
|
|
|
|
# Move last app to the top of `app_list`.
|
|
# TODO fournir un bon ordre
|
|
app_list = self.get_app_list(request)
|
|
app_list.insert(0, app_list.pop(-1))
|
|
|
|
extra_context['app_list'] = app_list
|
|
return super().index(request, extra_context)
|
|
|
|
|
|
# admin.site = CustomAdminSite(name='admin')
|
|
admin.site.register(User, UserAdmin)
|
|
# admin.site.register(Group, GroupAdmin)
|
|
# admin.site.register(Site, SiteAdmin)
|