mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-24 17:42:23 +00:00
Admin for non staff
This commit is contained in:
parent
aca1d2def6
commit
80055771e9
11
med/admin.py
11
med/admin.py
@ -3,6 +3,8 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.contrib.admin import AdminSite
|
||||
from django.contrib.auth.admin import Group, GroupAdmin
|
||||
from django.contrib.sites.admin import Site, SiteAdmin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.decorators.cache import never_cache
|
||||
|
||||
@ -25,5 +27,14 @@ class DatabaseAdmin(AdminSite):
|
||||
|
||||
return response
|
||||
|
||||
def has_permission(self, request):
|
||||
"""
|
||||
Authorize all active user to access admin
|
||||
"""
|
||||
return request.user.is_active
|
||||
|
||||
|
||||
# Instantiate admin site and register some defaults
|
||||
admin_site = DatabaseAdmin()
|
||||
admin_site.register(Group, GroupAdmin)
|
||||
admin_site.register(Site, SiteAdmin)
|
||||
|
Loading…
Reference in New Issue
Block a user