mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-28 15:42:25 +00:00
Add custom admin site for users
This commit is contained in:
parent
0bc1734cf3
commit
eca74aae6b
2 changed files with 12 additions and 0 deletions
10
re2o/admin.py
Normal file
10
re2o/admin.py
Normal 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')
|
|
@ -48,6 +48,7 @@ from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
|
|
||||||
|
from .admin import user_admin_site
|
||||||
from .views import index, about_page, contact_page
|
from .views import index, about_page, contact_page
|
||||||
|
|
||||||
handler500 = 're2o.views.handler500'
|
handler500 = 're2o.views.handler500'
|
||||||
|
@ -61,6 +62,7 @@ urlpatterns = [
|
||||||
url('^', include('django.contrib.auth.urls')),
|
url('^', include('django.contrib.auth.urls')),
|
||||||
url(r'^i18n/', include('django.conf.urls.i18n')),
|
url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
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'^users/', include('users.urls', namespace='users')),
|
||||||
url(r'^search/', include('search.urls', namespace='search')),
|
url(r'^search/', include('search.urls', namespace='search')),
|
||||||
url(
|
url(
|
||||||
|
|
Loading…
Reference in a new issue