Commit 5795d50c by Kálmán Viktor

network: access only for superusers

parent 70471140
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import user_passes_test
from django.contrib import admin from django.contrib import admin
from decorator_include import decorator_include
admin.autodiscover() admin.autodiscover()
...@@ -8,12 +9,15 @@ js_info_dict = { ...@@ -8,12 +9,15 @@ js_info_dict = {
'packages': ('one', ), 'packages': ('one', ),
} }
superuser_required = user_passes_test(lambda u: u.is_superuser)
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^admin/doc/', include('django.contrib.admindocs.urls'), ), url(r'^admin/doc/', include('django.contrib.admindocs.urls'), ),
url(r'^admin/', include(admin.site.urls), ), url(r'^admin/', include(admin.site.urls), ),
url(r'^network/', include('network.urls'), ), url(r'^network/', decorator_include(superuser_required,
'network.urls')),
url(r'^login/$', 'school.views.login', name='login', ), url(r'^login/$', 'school.views.login', name='login', ),
......
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from .views import (IndexView, from .views import (IndexView,
HostList, HostDetail, HostCreate, HostDelete, HostList, HostDetail, HostCreate, HostDelete,
VlanList, VlanDetail, VlanDelete, VlanCreate, VlanList, VlanDetail, VlanDelete, VlanCreate,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment