2017-08-03 12:41:30 +02:00
|
|
|
from django.conf.urls import url, include
|
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib.auth.decorators import login_required, permission_required
|
|
|
|
from django.views.generic import RedirectView
|
|
|
|
|
2017-09-16 02:41:30 +02:00
|
|
|
import debug_toolbar
|
2018-01-02 17:06:12 +01:00
|
|
|
from allauth_ens.views import capture_login, capture_logout
|
2017-09-16 02:41:30 +02:00
|
|
|
|
2017-08-03 12:41:30 +02:00
|
|
|
from app import views
|
|
|
|
|
|
|
|
urlpatterns = [
|
|
|
|
# Catch admin login/logout views.
|
2018-01-02 17:06:12 +01:00
|
|
|
url(r'^admin/login/', capture_login),
|
|
|
|
url(r'^admin/logout/', capture_logout),
|
2017-08-03 12:41:30 +02:00
|
|
|
|
|
|
|
# Admin urls include comes after.
|
|
|
|
url(r'^admin/', admin.site.urls),
|
|
|
|
|
|
|
|
# Base views with different required permissions.
|
|
|
|
url(r'^view/', views.HomeView.as_view(),
|
|
|
|
name='view'),
|
|
|
|
url(r'^user/', login_required()(views.HomeView.as_view()),
|
|
|
|
name='user-view'),
|
|
|
|
url(r'^root/', permission_required('foo.perm')(views.HomeView.as_view()),
|
|
|
|
name='root-view'),
|
|
|
|
|
|
|
|
# Authens urls (handle login/logout views).
|
|
|
|
url(r'^account/', include('allauth_ens.urls')),
|
|
|
|
|
|
|
|
|
|
|
|
# (Redirect from /)
|
2018-01-02 17:06:12 +01:00
|
|
|
url(r'^$', RedirectView.as_view(url='/view/'),
|
|
|
|
name='home'),
|
2017-08-03 12:41:30 +02:00
|
|
|
]
|
2017-09-16 02:41:30 +02:00
|
|
|
|
|
|
|
urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))]
|