From 41aa9c23b1fca4e9a922bd7f6dd4825735fe5107 Mon Sep 17 00:00:00 2001 From: Ethan Soergel Date: Mon, 21 Oct 2024 16:55:04 -0400 Subject: [PATCH] Use consistent v1 URL pattern for odata the "resource names" are `odata/cases` and `odata/forms`, so ensure that that is consistent between tastypie and non-tastypie views --- corehq/apps/api/odata/urls.py | 20 +++++++++++--------- corehq/apps/api/urls.py | 12 +++++++++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/corehq/apps/api/odata/urls.py b/corehq/apps/api/odata/urls.py index 47bd5c4b6e011..03c0f4d59fb9c 100644 --- a/corehq/apps/api/odata/urls.py +++ b/corehq/apps/api/odata/urls.py @@ -6,22 +6,24 @@ ODataFormServiceView, ) -urlpatterns = [ - url(r'cases/(?P[\w\-:]+)/(?P[\d]+)/$', +odata_case_urlpatterns = [ + url(r'(?P[\w\-:]+)/(?P[\d]+)/$', ODataCaseServiceView.as_view(), name=ODataCaseServiceView.table_urlname), - url(r'cases/(?P[\w\-:]+)/$', + url(r'(?P[\w\-:]+)/$', ODataCaseServiceView.as_view(), name=ODataCaseServiceView.urlname), - url(r'cases/(?P[\w\-:]+)/(?P[\d]+)/\$metadata$', + url(r'(?P[\w\-:]+)/(?P[\d]+)/\$metadata$', ODataCaseMetadataView.as_view(), name=ODataCaseMetadataView.table_urlname), - url(r'cases/(?P[\w\-:]+)/\$metadata$', + url(r'(?P[\w\-:]+)/\$metadata$', ODataCaseMetadataView.as_view(), name=ODataCaseMetadataView.urlname), +] - url(r'forms/(?P[\w\-:]+)/(?P[\d]+)/$', +odata_form_urlpatterns = [ + url(r'(?P[\w\-:]+)/(?P[\d]+)/$', ODataFormServiceView.as_view(), name=ODataFormServiceView.table_urlname), - url(r'forms/(?P[\w\-:]+)/$', + url(r'(?P[\w\-:]+)/$', ODataFormServiceView.as_view(), name=ODataFormServiceView.urlname), - url(r'forms/(?P[\w\-:]+)/(?P[\d]+)/\$metadata$', + url(r'(?P[\w\-:]+)/(?P[\d]+)/\$metadata$', ODataFormMetadataView.as_view(), name=ODataFormMetadataView.table_urlname), - url(r'forms/(?P[\w\-:]+)/\$metadata$', + url(r'(?P[\w\-:]+)/\$metadata$', ODataFormMetadataView.as_view(), name=ODataFormMetadataView.urlname), ] diff --git a/corehq/apps/api/urls.py b/corehq/apps/api/urls.py index f234faca80bec..3e8c6b3f6a9a9 100644 --- a/corehq/apps/api/urls.py +++ b/corehq/apps/api/urls.py @@ -39,7 +39,10 @@ CaseAttachmentAPI, view_form_attachment, ) -from corehq.apps.api.odata.urls import urlpatterns as odata_urlpatterns +from corehq.apps.api.odata.urls import ( + odata_case_urlpatterns, + odata_form_urlpatterns, +) from corehq.apps.api.resources import v0_1, v0_3, v0_4, v0_5 from corehq.apps.api.resources.messaging_event.view import messaging_events from corehq.apps.api.resources.v0_5 import ( @@ -122,8 +125,11 @@ def versioned_apis(api_list): urlpatterns = [ - url(r'(?Pv0.5)/odata/', include(odata_urlpatterns)), - url(r'odata/(?Pv1)/', include(odata_urlpatterns)), + url(r'(?Pv0.5)/odata/cases/', include(odata_case_urlpatterns)), + url(r'(?Pv0.5)/odata/forms/', include(odata_form_urlpatterns)), + url(r'odata/cases/(?Pv1)/', include(odata_case_urlpatterns)), + url(r'odata/forms/(?Pv1)/', include(odata_form_urlpatterns)), + url(r'(?Pv0.5)/messaging-event/$', messaging_events, name="api_messaging_event_list"), url(r'(?Pv0.5)/messaging-event/(?P\d+)/$',