oacpl/OACPL/urls.py

37 lines
1.4 KiB
Python
Raw Normal View History

2017-08-17 13:20:57 -04:00
import os
from django.conf import settings
from django.conf.urls import url
2017-08-17 13:20:57 -04:00
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.shortcuts import Http404
2017-08-17 13:20:57 -04:00
from django.views.static import serve
import main.views
2017-09-05 19:29:42 -04:00
import case_law.views
2017-08-17 13:20:57 -04:00
import charter_members.views
2017-09-14 13:52:39 -04:00
import expert_witnesses.views
2017-09-03 17:02:57 -04:00
import newsletters.views
2017-08-17 13:20:57 -04:00
@login_required
def protected_serve(request, path, document_root=None, show_indexes=False):
if not request.user.has_perm('view_pdf'):
return Http404()
2017-08-17 13:20:57 -04:00
return serve(request, path, document_root, show_indexes)
2017-09-03 17:02:57 -04:00
2017-08-17 13:20:57 -04:00
urlpatterns = [
2017-08-18 21:24:33 -04:00
url(r'^$', main.views.index, name='home'),
2017-08-18 23:37:16 -04:00
url(r'^admin/logout', main.views.logout, name='logout'),
2017-08-18 21:24:33 -04:00
url(r'^admin/', admin.site.urls, name='admin'),
2017-09-03 15:59:37 -04:00
url(r'^attorney/(?P<id>\d+)', charter_members.views.index, name='attorney'),
2017-09-14 13:52:39 -04:00
url(r'^caselaw/', case_law.views.browser, name='caselaw'),
url(r'^experts/', expert_witnesses.views.browser, name='experts'),
url(r'^experts/(<?P<id>\d+)', expert_witnesses.views.viewer, name='expert'),
2017-08-18 21:24:33 -04:00
url(r'^media/secure/(?P<path>.*)$', protected_serve, {'document_root': os.path.join(settings.MEDIA_ROOT, 'secure')}, name='secure media'),
2017-09-03 17:02:57 -04:00
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
url(r'^newsletter/subscribe', newsletters.views.subscribe, name='subscribe'),
2017-09-04 02:30:16 -04:00
url(r'^newsletter/', newsletters.views.newsletters, name='newsletters'),
2017-08-17 13:20:57 -04:00
]