From 7e43b69ae944726b6f7fb8c242a136ccd920fd91 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 14 Mar 2023 23:11:03 +1100 Subject: [PATCH] More URL cleanup --- InvenTree/part/api.py | 24 ++++++++++++------------ InvenTree/report/api.py | 10 +++++----- InvenTree/stock/api.py | 10 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 74f49fd0a7..a0127dee69 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -1938,7 +1938,7 @@ part_api_urls = [ ])), # Category detail endpoints - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'^metadata/', CategoryMetadata.as_view(), name='api-part-category-metadata'), @@ -1951,42 +1951,42 @@ part_api_urls = [ # Base URL for PartTestTemplate API endpoints re_path(r'^test-template/', include([ - re_path(r'^(?P\d+)/', PartTestTemplateDetail.as_view(), name='api-part-test-template-detail'), + path(r'/', PartTestTemplateDetail.as_view(), name='api-part-test-template-detail'), path('', PartTestTemplateList.as_view(), name='api-part-test-template-list'), ])), # Base URL for PartAttachment API endpoints re_path(r'^attachment/', include([ - re_path(r'^(?P\d+)/', PartAttachmentDetail.as_view(), name='api-part-attachment-detail'), + path(r'/', PartAttachmentDetail.as_view(), name='api-part-attachment-detail'), path('', PartAttachmentList.as_view(), name='api-part-attachment-list'), ])), # Base URL for part sale pricing re_path(r'^sale-price/', include([ - re_path(r'^(?P\d+)/', PartSalePriceDetail.as_view(), name='api-part-sale-price-detail'), + path(r'/', PartSalePriceDetail.as_view(), name='api-part-sale-price-detail'), re_path(r'^.*$', PartSalePriceList.as_view(), name='api-part-sale-price-list'), ])), # Base URL for part internal pricing re_path(r'^internal-price/', include([ - re_path(r'^(?P\d+)/', PartInternalPriceDetail.as_view(), name='api-part-internal-price-detail'), + path(r'/', PartInternalPriceDetail.as_view(), name='api-part-internal-price-detail'), re_path(r'^.*$', PartInternalPriceList.as_view(), name='api-part-internal-price-list'), ])), # Base URL for PartRelated API endpoints re_path(r'^related/', include([ - re_path(r'^(?P\d+)/', PartRelatedDetail.as_view(), name='api-part-related-detail'), + path(r'/', PartRelatedDetail.as_view(), name='api-part-related-detail'), re_path(r'^.*$', PartRelatedList.as_view(), name='api-part-related-list'), ])), # Base URL for PartParameter API endpoints re_path(r'^parameter/', include([ path('template/', include([ - re_path(r'^(?P\d+)/', PartParameterTemplateDetail.as_view(), name='api-part-parameter-template-detail'), + path(r'/', PartParameterTemplateDetail.as_view(), name='api-part-parameter-template-detail'), re_path(r'^.*$', PartParameterTemplateList.as_view(), name='api-part-parameter-template-list'), ])), - re_path(r'^(?P\d+)/', PartParameterDetail.as_view(), name='api-part-parameter-detail'), + path(r'/', PartParameterDetail.as_view(), name='api-part-parameter-detail'), re_path(r'^.*$', PartParameterList.as_view(), name='api-part-parameter-list'), ])), @@ -1998,7 +1998,7 @@ part_api_urls = [ re_path(r'^.*$', PartStocktakeReportList.as_view(), name='api-part-stocktake-report-list'), ])), - re_path(r'^(?P\d+)/', PartStocktakeDetail.as_view(), name='api-part-stocktake-detail'), + path(r'/', PartStocktakeDetail.as_view(), name='api-part-stocktake-detail'), re_path(r'^.*$', PartStocktakeList.as_view(), name='api-part-stocktake-list'), ])), @@ -2010,7 +2010,7 @@ part_api_urls = [ # BOM template re_path(r'^bom_template/?', views.BomUploadTemplate.as_view(), name='api-bom-upload-template'), - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ # Endpoint for extra serial number information re_path(r'^serial-numbers/', PartSerialNumberDetail.as_view(), name='api-part-serial-number-detail'), @@ -2050,14 +2050,14 @@ bom_api_urls = [ re_path(r'^substitute/', include([ # Detail view - re_path(r'^(?P\d+)/', BomItemSubstituteDetail.as_view(), name='api-bom-substitute-detail'), + path(r'/', BomItemSubstituteDetail.as_view(), name='api-bom-substitute-detail'), # Catch all re_path(r'^.*$', BomItemSubstituteList.as_view(), name='api-bom-substitute-list'), ])), # BOM Item Detail - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'^validate/?', BomItemValidate.as_view(), name='api-bom-item-validate'), re_path(r'^.*$', BomDetail.as_view(), name='api-bom-item-detail'), ])), diff --git a/InvenTree/report/api.py b/InvenTree/report/api.py index 738c7b859b..01963b7e83 100644 --- a/InvenTree/report/api.py +++ b/InvenTree/report/api.py @@ -688,7 +688,7 @@ report_api_urls = [ # Purchase order reports re_path(r'po/', include([ # Detail views - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'print/', PurchaseOrderReportPrint.as_view(), name='api-po-report-print'), path('', PurchaseOrderReportDetail.as_view(), name='api-po-report-detail'), ])), @@ -700,7 +700,7 @@ report_api_urls = [ # Sales order reports re_path(r'so/', include([ # Detail views - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'print/', SalesOrderReportPrint.as_view(), name='api-so-report-print'), path('', SalesOrderReportDetail.as_view(), name='api-so-report-detail'), ])), @@ -711,7 +711,7 @@ report_api_urls = [ # Build reports re_path(r'build/', include([ # Detail views - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'print/?', BuildReportPrint.as_view(), name='api-build-report-print'), re_path(r'^.$', BuildReportDetail.as_view(), name='api-build-report-detail'), ])), @@ -724,7 +724,7 @@ report_api_urls = [ re_path(r'bom/', include([ # Detail views - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'print/?', BOMReportPrint.as_view(), name='api-bom-report-print'), re_path(r'^.*$', BOMReportDetail.as_view(), name='api-bom-report-detail'), ])), @@ -736,7 +736,7 @@ report_api_urls = [ # Stock item test reports re_path(r'test/', include([ # Detail views - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'print/?', StockItemTestReportPrint.as_view(), name='api-stockitem-testreport-print'), re_path(r'^.*$', StockItemTestReportDetail.as_view(), name='api-stockitem-testreport-detail'), ])), diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 1c1429cf0e..79364b06de 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -1368,7 +1368,7 @@ stock_api_urls = [ re_path(r'^tree/', StockLocationTree.as_view(), name='api-location-tree'), # Stock location detail endpoints - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'^metadata/', LocationMetadata.as_view(), name='api-location-metadata'), @@ -1388,24 +1388,24 @@ stock_api_urls = [ # StockItemAttachment API endpoints re_path(r'^attachment/', include([ - re_path(r'^(?P\d+)/', StockAttachmentDetail.as_view(), name='api-stock-attachment-detail'), + path(r'/', StockAttachmentDetail.as_view(), name='api-stock-attachment-detail'), path('', StockAttachmentList.as_view(), name='api-stock-attachment-list'), ])), # StockItemTestResult API endpoints re_path(r'^test/', include([ - re_path(r'^(?P\d+)/', StockItemTestResultDetail.as_view(), name='api-stock-test-result-detail'), + path(r'/', StockItemTestResultDetail.as_view(), name='api-stock-test-result-detail'), re_path(r'^.*$', StockItemTestResultList.as_view(), name='api-stock-test-result-list'), ])), # StockItemTracking API endpoints re_path(r'^track/', include([ - re_path(r'^(?P\d+)/', StockTrackingDetail.as_view(), name='api-stock-tracking-detail'), + path(r'/', StockTrackingDetail.as_view(), name='api-stock-tracking-detail'), re_path(r'^.*$', StockTrackingList.as_view(), name='api-stock-tracking-list'), ])), # Detail views for a single stock item - re_path(r'^(?P\d+)/', include([ + path(r'/', include([ re_path(r'^convert/', StockItemConvert.as_view(), name='api-stock-item-convert'), re_path(r'^install/', StockItemInstall.as_view(), name='api-stock-item-install'), re_path(r'^metadata/', StockMetadata.as_view(), name='api-stock-item-metadata'),