oacpl/OACPL/urls.py

60 lines
2.6 KiB
Python
Raw Normal View History

2017-08-17 13:20:57 -04:00
import os
from django.conf import settings
2017-09-29 20:07:18 -04:00
from django.conf.urls import url, include
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
2018-02-26 22:02:50 -05:00
import events.views
2017-10-24 00:57:44 -04:00
import forum.views
2017-09-03 17:02:57 -04:00
import newsletters.views
2018-02-25 23:48:34 -05:00
import newsroom.views
2017-08-17 13:20:57 -04:00
@login_required
2018-01-14 18:34:28 -05:00
def serve_case(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
2018-01-14 18:34:28 -05:00
@login_required
def serve_cv(request, path, document_root=None, show_indexes=False):
if not request.user.has_perm('view_cv'):
return Http404()
return serve(request, path, document_root, show_indexes)
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-10-24 00:57:44 -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'),
2017-09-16 15:58:49 -04:00
url(r'^contact/', main.views.contact, name='contact'),
2017-09-16 18:45:21 -04:00
url(r'^experts/(?P<id>\d+)', expert_witnesses.views.viewer, name='expert'),
2017-09-16 18:46:59 -04:00
url(r'^experts/', expert_witnesses.views.browser, name='experts'),
2018-02-26 22:02:50 -05:00
url(r'^events/register', events.views.register, name='register'),
url(r'^events/', events.views.view, name='events'),
2018-01-11 00:58:07 -05:00
url(r'^forum/post/(?P<post>\d*)', forum.views.viewPost, name='post'),
2017-10-24 00:57:44 -04:00
url(r'^forum/(?P<thread>\d*)?', forum.views.view, name='forum'),
2017-09-15 10:50:24 -04:00
url(r'^login/', main.views.login, name='login'),
url(r'^logout/', main.views.logout, name='logout'),
2018-01-14 18:34:28 -05:00
url(r'^media/case_law/(?P<path>.*)$', serve_case, {'document_root': os.path.join(settings.MEDIA_ROOT, 'case_law')}, name='media caselaw'),
url(r'^media/cv/(?P<path>.*)$', serve_cv, {'document_root': os.path.join(settings.MEDIA_ROOT, 'cv')}, name='media cv'),
2017-09-03 17:02:57 -04:00
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
2018-01-14 17:55:35 -05:00
url(r'^members', charter_members.views.all, name='members'),
2018-01-14 17:15:28 -05:00
url(r'^newsletter/unsubscribe', newsletters.views.unsubscribe, name='unsubscribe'),
2018-01-05 19:12:27 -05:00
url(r'^newsletter/', newsletters.views.newsletters, name='newsletters'),
2018-02-25 23:48:34 -05:00
url(r'^newsroom/', newsroom.views.newsroom, name='newsroom'),
2018-01-25 14:49:47 -05:00
url(r'^resetToken', main.views.reset_token, name='reset token'),
url(r'^reset/', main.views.reset, name='reset'),
2018-01-05 19:12:27 -05:00
url(r'^tinymce/', include('tinymce.urls'))
2017-08-17 13:20:57 -04:00
]