forked from ODM2/ODM2ControlledVocabularies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
79 lines (63 loc) · 2.84 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from cvservices.api import v1_api
from cvinterface.controlled_vocabularies import requests
from cvinterface.views.vocabulary_views import VocabulariesView, list_views, detail_views
from cvinterface.views.request_views import RequestsView, \
request_list_views, request_create_views, request_update_views
login_configuration = {
'template_name': 'cvinterface/account/login.html',
'redirect_field_name': 'next'
}
logout_configuration = {
'next_page': reverse_lazy('home')
}
urlpatterns = [
url(r'^' + settings.SITE_URL + '$', VocabulariesView.as_view(), name='home'),
url(r'^' + settings.SITE_URL + 'api/', include(v1_api.urls)),
url(r'^' + settings.SITE_URL + 'admin/', include(admin.site.urls)),
url(r'^' + settings.SITE_URL + 'requests/$', RequestsView.as_view(), name='requests_list'),
url(r'^' + settings.SITE_URL + 'login/$', auth_views.login, login_configuration, name='login'),
url(r'^' + settings.SITE_URL + 'logout/$', auth_views.logout, logout_configuration, name='logout'),
]
# cv list views
for cv_name in list_views:
view = list_views[cv_name]
urlpatterns += [
url(r'^' + settings.SITE_URL + cv_name + '/$', view, name=cv_name),
]
# cv detail views
for cv_name in detail_views:
view = detail_views[cv_name]
urlpatterns += [
url(r'^' + settings.SITE_URL + cv_name + '/(?P<slug>[-\w]+)/(?P<pk>[-\w]+)/$', view, name=cv_name + '_detail'),
]
urlpatterns += [
url(r'^' + settings.SITE_URL + cv_name + '/(?P<slug>[-\w]+)/$', view, name=cv_name + '_detail'),
]
# request list views
for request_name in request_list_views:
view = request_list_views[request_name]
urlpatterns += [
url(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/$', view,
name=request_name),
]
# request create views
for request_name in request_create_views:
view = request_create_views[request_name]
urlpatterns += [
url(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/new/$', view,
name=requests[request_name]['vocabulary'] + '_form'),
url(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/new/(?P<vocabulary_id>[\w]+)/$',
view, name=requests[request_name]['vocabulary'] + '_form'),
]
# request update views
for request_name in request_update_views:
view = request_update_views[request_name]
urlpatterns += [
url(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/(?P<pk>[-\w]+)/$', view,
name=requests[request_name]['vocabulary'] + '_update_form'),
]