mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10:54 +00:00
Move more paths to basic path (#6251)
* move more paths to basic path * changed url route to only match fully - fixed test * revert path changes on labelprint pages * fix not found/redirect * revert test change
This commit is contained in:
@ -7,7 +7,7 @@ from django.core.exceptions import ValidationError as DjangoValidationError
|
||||
from django.db import transaction
|
||||
from django.db.models import F, Q
|
||||
from django.http import JsonResponse
|
||||
from django.urls import include, path, re_path
|
||||
from django.urls import include, path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from django_filters import rest_framework as rest_filters
|
||||
@ -1485,69 +1485,63 @@ class LocationDetail(CustomRetrieveUpdateDestroyAPI):
|
||||
|
||||
|
||||
stock_api_urls = [
|
||||
re_path(
|
||||
r'^location/',
|
||||
path(
|
||||
'location/',
|
||||
include([
|
||||
re_path(r'^tree/', StockLocationTree.as_view(), name='api-location-tree'),
|
||||
path('tree/', StockLocationTree.as_view(), name='api-location-tree'),
|
||||
# Stock location detail endpoints
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
include([
|
||||
re_path(
|
||||
r'^metadata/',
|
||||
path(
|
||||
'metadata/',
|
||||
MetadataView.as_view(),
|
||||
{'model': StockLocation},
|
||||
name='api-location-metadata',
|
||||
),
|
||||
re_path(
|
||||
r'^.*$', LocationDetail.as_view(), name='api-location-detail'
|
||||
),
|
||||
path('', LocationDetail.as_view(), name='api-location-detail'),
|
||||
]),
|
||||
),
|
||||
re_path(r'^.*$', StockLocationList.as_view(), name='api-location-list'),
|
||||
path('', StockLocationList.as_view(), name='api-location-list'),
|
||||
]),
|
||||
),
|
||||
# Stock location type endpoints
|
||||
re_path(
|
||||
r'^location-type/',
|
||||
path(
|
||||
'location-type/',
|
||||
include([
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
include([
|
||||
re_path(
|
||||
r'^metadata/',
|
||||
path(
|
||||
'metadata/',
|
||||
MetadataView.as_view(),
|
||||
{'model': StockLocationType},
|
||||
name='api-location-type-metadata',
|
||||
),
|
||||
re_path(
|
||||
r'^.*$',
|
||||
path(
|
||||
'',
|
||||
StockLocationTypeDetail.as_view(),
|
||||
name='api-location-type-detail',
|
||||
),
|
||||
]),
|
||||
),
|
||||
re_path(
|
||||
r'^.*$', StockLocationTypeList.as_view(), name='api-location-type-list'
|
||||
),
|
||||
path('', StockLocationTypeList.as_view(), name='api-location-type-list'),
|
||||
]),
|
||||
),
|
||||
# Endpoints for bulk stock adjustment actions
|
||||
re_path(r'^count/', StockCount.as_view(), name='api-stock-count'),
|
||||
re_path(r'^add/', StockAdd.as_view(), name='api-stock-add'),
|
||||
re_path(r'^remove/', StockRemove.as_view(), name='api-stock-remove'),
|
||||
re_path(r'^transfer/', StockTransfer.as_view(), name='api-stock-transfer'),
|
||||
re_path(r'^assign/', StockAssign.as_view(), name='api-stock-assign'),
|
||||
re_path(r'^merge/', StockMerge.as_view(), name='api-stock-merge'),
|
||||
re_path(
|
||||
r'^change_status/', StockChangeStatus.as_view(), name='api-stock-change-status'
|
||||
),
|
||||
path('count/', StockCount.as_view(), name='api-stock-count'),
|
||||
path('add/', StockAdd.as_view(), name='api-stock-add'),
|
||||
path('remove/', StockRemove.as_view(), name='api-stock-remove'),
|
||||
path('transfer/', StockTransfer.as_view(), name='api-stock-transfer'),
|
||||
path('assign/', StockAssign.as_view(), name='api-stock-assign'),
|
||||
path('merge/', StockMerge.as_view(), name='api-stock-merge'),
|
||||
path('change_status/', StockChangeStatus.as_view(), name='api-stock-change-status'),
|
||||
# StockItemAttachment API endpoints
|
||||
re_path(
|
||||
r'^attachment/',
|
||||
path(
|
||||
'attachment/',
|
||||
include([
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
StockAttachmentDetail.as_view(),
|
||||
name='api-stock-attachment-detail',
|
||||
),
|
||||
@ -1555,92 +1549,82 @@ stock_api_urls = [
|
||||
]),
|
||||
),
|
||||
# StockItemTestResult API endpoints
|
||||
re_path(
|
||||
r'^test/',
|
||||
path(
|
||||
'test/',
|
||||
include([
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
include([
|
||||
re_path(
|
||||
r'^metadata/',
|
||||
path(
|
||||
'metadata/',
|
||||
MetadataView.as_view(),
|
||||
{'model': StockItemTestResult},
|
||||
name='api-stock-test-result-metadata',
|
||||
),
|
||||
re_path(
|
||||
r'^.*$',
|
||||
path(
|
||||
'',
|
||||
StockItemTestResultDetail.as_view(),
|
||||
name='api-stock-test-result-detail',
|
||||
),
|
||||
]),
|
||||
),
|
||||
re_path(
|
||||
r'^.*$',
|
||||
StockItemTestResultList.as_view(),
|
||||
name='api-stock-test-result-list',
|
||||
path(
|
||||
'', StockItemTestResultList.as_view(), name='api-stock-test-result-list'
|
||||
),
|
||||
]),
|
||||
),
|
||||
# StockItemTracking API endpoints
|
||||
re_path(
|
||||
r'^track/',
|
||||
path(
|
||||
'track/',
|
||||
include([
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
StockTrackingDetail.as_view(),
|
||||
name='api-stock-tracking-detail',
|
||||
),
|
||||
# Stock tracking status code information
|
||||
re_path(
|
||||
r'status/',
|
||||
path(
|
||||
'status/',
|
||||
StatusView.as_view(),
|
||||
{StatusView.MODEL_REF: StockHistoryCode},
|
||||
name='api-stock-tracking-status-codes',
|
||||
),
|
||||
re_path(
|
||||
r'^.*$', StockTrackingList.as_view(), name='api-stock-tracking-list'
|
||||
),
|
||||
path('', StockTrackingList.as_view(), name='api-stock-tracking-list'),
|
||||
]),
|
||||
),
|
||||
# Detail views for a single stock item
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
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/',
|
||||
path('convert/', StockItemConvert.as_view(), name='api-stock-item-convert'),
|
||||
path('install/', StockItemInstall.as_view(), name='api-stock-item-install'),
|
||||
path(
|
||||
'metadata/',
|
||||
MetadataView.as_view(),
|
||||
{'model': StockItem},
|
||||
name='api-stock-item-metadata',
|
||||
),
|
||||
re_path(
|
||||
r'^return/', StockItemReturn.as_view(), name='api-stock-item-return'
|
||||
),
|
||||
re_path(
|
||||
r'^serialize/',
|
||||
path('return/', StockItemReturn.as_view(), name='api-stock-item-return'),
|
||||
path(
|
||||
'serialize/',
|
||||
StockItemSerialize.as_view(),
|
||||
name='api-stock-item-serialize',
|
||||
),
|
||||
re_path(
|
||||
r'^uninstall/',
|
||||
path(
|
||||
'uninstall/',
|
||||
StockItemUninstall.as_view(),
|
||||
name='api-stock-item-uninstall',
|
||||
),
|
||||
re_path(r'^.*$', StockDetail.as_view(), name='api-stock-detail'),
|
||||
path('', StockDetail.as_view(), name='api-stock-detail'),
|
||||
]),
|
||||
),
|
||||
# Stock item status code information
|
||||
re_path(
|
||||
r'status/',
|
||||
path(
|
||||
'status/',
|
||||
StatusView.as_view(),
|
||||
{StatusView.MODEL_REF: StockStatus},
|
||||
name='api-stock-status-codes',
|
||||
),
|
||||
# Anything else
|
||||
re_path(r'^.*$', StockList.as_view(), name='api-stock-list'),
|
||||
path('', StockList.as_view(), name='api-stock-list'),
|
||||
]
|
||||
|
@ -1,33 +1,29 @@
|
||||
"""URL lookup for Stock app."""
|
||||
|
||||
from django.urls import include, path, re_path
|
||||
from django.urls import include, path
|
||||
|
||||
from stock import views
|
||||
|
||||
location_urls = [
|
||||
path(
|
||||
r'<int:pk>/',
|
||||
'<int:pk>/',
|
||||
include([
|
||||
# Anything else - direct to the location detail view
|
||||
re_path(
|
||||
'^.*$',
|
||||
views.StockLocationDetail.as_view(),
|
||||
name='stock-location-detail',
|
||||
)
|
||||
path('', views.StockLocationDetail.as_view(), name='stock-location-detail')
|
||||
]),
|
||||
)
|
||||
]
|
||||
|
||||
stock_item_detail_urls = [
|
||||
# Anything else - direct to the item detail view
|
||||
re_path('^.*$', views.StockItemDetail.as_view(), name='stock-item-detail')
|
||||
path('', views.StockItemDetail.as_view(), name='stock-item-detail')
|
||||
]
|
||||
|
||||
stock_urls = [
|
||||
# Stock location
|
||||
re_path(r'^location/', include(location_urls)),
|
||||
path('location/', include(location_urls)),
|
||||
# Individual stock items
|
||||
re_path(r'^item/(?P<pk>\d+)/', include(stock_item_detail_urls)),
|
||||
path('item/<int:pk>/', include(stock_item_detail_urls)),
|
||||
# Default to the stock index page
|
||||
re_path(r'^.*$', views.StockIndex.as_view(), name='stock-index'),
|
||||
path('', views.StockIndex.as_view(), name='stock-index'),
|
||||
]
|
||||
|
Reference in New Issue
Block a user