Skip to content

Commit

Permalink
#46 #55 #56 Updated CV detail view and requests views' path format.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaraballo17 committed Oct 28, 2020
1 parent 2fb18c3 commit d28e0fc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/odm2cvs/odm2cvs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.views.generic import ListView
from django.views.generic import ListView, DetailView

from cvservices.api import v1_api
from cvinterface.views.base_views import UnitsListView
Expand Down Expand Up @@ -42,13 +42,14 @@

# cv detail views
for cv_name in detail_views:
view = detail_views[cv_name]
view: DetailView = detail_views[cv_name]

# TODO: find a django 3.1 equivalent of this slug + pk mess.
urlpatterns += [
path(r'^' + settings.SITE_URL + cv_name + '/(?P<slug>[-\w]+)/(?P<pk>[-\w]+)/$', view, name=cv_name + '_detail'),
path(f'{cv_name}/(?P<slug>[-\w]+)/(?P<pk>[-\w]+)/$', view, name=cv_name + '_detail'),
]
urlpatterns += [
path(r'^' + settings.SITE_URL + cv_name + '/(?P<slug>[-\w]+)/$', view, name=cv_name + '_detail'),
path(f'{cv_name}/(?P<slug>[-\w]+)/$', view, name=cv_name + '_detail'),
]


Expand All @@ -57,17 +58,17 @@
view = request_list_views[request_name]

urlpatterns += [
path(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/$', view,
name=request_name),
path(f'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 += [
path(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/new/$', view,
path(f'requests/{requests[request_name]["vocabulary"]}/new/$', view,
name=requests[request_name]['vocabulary'] + '_form'),
path(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/new/(?P<vocabulary_id>[\w]+)/$',
# TODO: change vocabulary_id field here.
path(f'requests/{requests[request_name]["vocabulary"]}/new/(?P<vocabulary_id>[\w]+)/$',
view, name=requests[request_name]['vocabulary'] + '_form'),
]

Expand All @@ -76,6 +77,7 @@
view = request_update_views[request_name]

urlpatterns += [
path(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/(?P<pk>[-\w]+)/$', view,
# TODO: change pk here.
path(f'requests/{requests[request_name]["vocabulary"]}/(?P<pk>[-\w]+)/$', view,
name=requests[request_name]['vocabulary'] + '_update_form'),
]

0 comments on commit d28e0fc

Please sign in to comment.