diff --git a/src/odm2cvs/odm2cvs/urls.py b/src/odm2cvs/odm2cvs/urls.py index 0a4518c..67b4db1 100644 --- a/src/odm2cvs/odm2cvs/urls.py +++ b/src/odm2cvs/odm2cvs/urls.py @@ -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 @@ -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[-\w]+)/(?P[-\w]+)/$', view, name=cv_name + '_detail'), + path(f'{cv_name}/(?P[-\w]+)/(?P[-\w]+)/$', view, name=cv_name + '_detail'), ] urlpatterns += [ - path(r'^' + settings.SITE_URL + cv_name + '/(?P[-\w]+)/$', view, name=cv_name + '_detail'), + path(f'{cv_name}/(?P[-\w]+)/$', view, name=cv_name + '_detail'), ] @@ -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[\w]+)/$', + # TODO: change vocabulary_id field here. + path(f'requests/{requests[request_name]["vocabulary"]}/new/(?P[\w]+)/$', view, name=requests[request_name]['vocabulary'] + '_form'), ] @@ -76,6 +77,7 @@ view = request_update_views[request_name] urlpatterns += [ - path(r'^' + settings.SITE_URL + 'requests/' + requests[request_name]['vocabulary'] + '/(?P[-\w]+)/$', view, + # TODO: change pk here. + path(f'requests/{requests[request_name]["vocabulary"]}/(?P[-\w]+)/$', view, name=requests[request_name]['vocabulary'] + '_update_form'), ]