poulpe/shared/admin.py

35 lines
1 KiB
Python
Raw Normal View History

from django.contrib import admin
2018-08-04 05:38:03 +02:00
from django.contrib.admin import AdminSite
from django.contrib.sites.admin import SiteAdmin
from django.contrib.sites.models import Site
2018-08-04 05:38:03 +02:00
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)
2018-08-27 14:03:06 +02:00
# admin.site = CustomAdminSite(name='admin')
2018-08-04 05:38:03 +02:00
admin.site.register(User, UserAdmin)
2018-08-27 14:03:06 +02:00
# admin.site.register(Group, GroupAdmin)
# admin.site.register(Site, SiteAdmin)