diff --git a/re2o/admin.py b/re2o/admin.py new file mode 100644 index 00000000..fb680a83 --- /dev/null +++ b/re2o/admin.py @@ -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') diff --git a/re2o/urls.py b/re2o/urls.py index 39f51ec3..ee3f56fa 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -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(