8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Add custom admin site for users

This commit is contained in:
Alexandre Iooss 2019-02-16 09:53:42 +01:00 committed by Alexandre IOOSS
parent 0bc1734cf3
commit eca74aae6b
2 changed files with 12 additions and 0 deletions

10
re2o/admin.py Normal file
View file

@ -0,0 +1,10 @@
from django.contrib.admin.sites import AdminSite
class UserAdmin(AdminSite):
def has_permission(self, request):
"""This admin site doesn't require being staff"""
return request.user.is_active
user_admin_site = UserAdmin(name='user_admin')

View file

@ -48,6 +48,7 @@ from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from .admin import user_admin_site
from .views import index, about_page, contact_page
handler500 = 're2o.views.handler500'
@ -61,6 +62,7 @@ urlpatterns = [
url('^', include('django.contrib.auth.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^manage/', include(user_admin_site.urls)),
url(r'^users/', include('users.urls', namespace='users')),
url(r'^search/', include('search.urls', namespace='search')),
url(