mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 19:45:46 +00:00
URL cleanup
- Use <int:pk> instead of complex regex
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
"""JSON API for the Build app."""
|
"""JSON API for the Build app."""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
@ -487,18 +487,18 @@ build_api_urls = [
|
|||||||
|
|
||||||
# Attachments
|
# Attachments
|
||||||
re_path(r'^attachment/', include([
|
re_path(r'^attachment/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', BuildAttachmentDetail.as_view(), name='api-build-attachment-detail'),
|
path(r'<int:pk>/', BuildAttachmentDetail.as_view(), name='api-build-attachment-detail'),
|
||||||
re_path(r'^.*$', BuildAttachmentList.as_view(), name='api-build-attachment-list'),
|
re_path(r'^.*$', BuildAttachmentList.as_view(), name='api-build-attachment-list'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
# Build Items
|
# Build Items
|
||||||
re_path(r'^item/', include([
|
re_path(r'^item/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', BuildItemDetail.as_view(), name='api-build-item-detail'),
|
path(r'<int:pk>/', BuildItemDetail.as_view(), name='api-build-item-detail'),
|
||||||
re_path(r'^.*$', BuildItemList.as_view(), name='api-build-item-list'),
|
re_path(r'^.*$', BuildItemList.as_view(), name='api-build-item-list'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
# Build Detail
|
# Build Detail
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'^allocate/', BuildAllocate.as_view(), name='api-build-allocate'),
|
re_path(r'^allocate/', BuildAllocate.as_view(), name='api-build-allocate'),
|
||||||
re_path(r'^auto-allocate/', BuildAutoAllocate.as_view(), name='api-build-auto-allocate'),
|
re_path(r'^auto-allocate/', BuildAutoAllocate.as_view(), name='api-build-auto-allocate'),
|
||||||
re_path(r'^complete/', BuildOutputComplete.as_view(), name='api-build-output-complete'),
|
re_path(r'^complete/', BuildOutputComplete.as_view(), name='api-build-output-complete'),
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"""URL lookup for Build app."""
|
"""URL lookup for Build app."""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
build_urls = [
|
build_urls = [
|
||||||
|
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'^.*$', views.BuildDetail.as_view(), name='build-detail'),
|
re_path(r'^.*$', views.BuildDetail.as_view(), name='build-detail'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ settings_api_urls = [
|
|||||||
# Notification settings
|
# Notification settings
|
||||||
re_path(r'^notification/', include([
|
re_path(r'^notification/', include([
|
||||||
# Notification Settings Detail
|
# Notification Settings Detail
|
||||||
re_path(r'^(?P<pk>\d+)/', NotificationUserSettingsDetail.as_view(), name='api-notification-setting-detail'),
|
path(r'<int:pk>/', NotificationUserSettingsDetail.as_view(), name='api-notification-setting-detail'),
|
||||||
|
|
||||||
# Notification Settings List
|
# Notification Settings List
|
||||||
re_path(r'^.*$', NotificationUserSettingsList.as_view(), name='api-notifcation-setting-list'),
|
re_path(r'^.*$', NotificationUserSettingsList.as_view(), name='api-notifcation-setting-list'),
|
||||||
@ -486,7 +486,7 @@ common_api_urls = [
|
|||||||
# Notifications
|
# Notifications
|
||||||
re_path(r'^notifications/', include([
|
re_path(r'^notifications/', include([
|
||||||
# Individual purchase order detail URLs
|
# Individual purchase order detail URLs
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'.*$', NotificationDetail.as_view(), name='api-notifications-detail'),
|
re_path(r'.*$', NotificationDetail.as_view(), name='api-notifications-detail'),
|
||||||
])),
|
])),
|
||||||
# Read all
|
# Read all
|
||||||
@ -498,7 +498,7 @@ common_api_urls = [
|
|||||||
|
|
||||||
# News
|
# News
|
||||||
re_path(r'^news/', include([
|
re_path(r'^news/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'.*$', NewsFeedEntryDetail.as_view(), name='api-news-detail'),
|
re_path(r'.*$', NewsFeedEntryDetail.as_view(), name='api-news-detail'),
|
||||||
])),
|
])),
|
||||||
re_path(r'^.*$', NewsFeedEntryList.as_view(), name='api-news-list'),
|
re_path(r'^.*$', NewsFeedEntryList.as_view(), name='api-news-list'),
|
||||||
|
@ -535,12 +535,12 @@ manufacturer_part_api_urls = [
|
|||||||
|
|
||||||
# Base URL for ManufacturerPartAttachment API endpoints
|
# Base URL for ManufacturerPartAttachment API endpoints
|
||||||
re_path(r'^attachment/', include([
|
re_path(r'^attachment/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', ManufacturerPartAttachmentDetail.as_view(), name='api-manufacturer-part-attachment-detail'),
|
path(r'<int:pk>/', ManufacturerPartAttachmentDetail.as_view(), name='api-manufacturer-part-attachment-detail'),
|
||||||
re_path(r'^$', ManufacturerPartAttachmentList.as_view(), name='api-manufacturer-part-attachment-list'),
|
re_path(r'^$', ManufacturerPartAttachmentList.as_view(), name='api-manufacturer-part-attachment-list'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
re_path(r'^parameter/', include([
|
re_path(r'^parameter/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', ManufacturerPartParameterDetail.as_view(), name='api-manufacturer-part-parameter-detail'),
|
path(r'<int:pk>/', ManufacturerPartParameterDetail.as_view(), name='api-manufacturer-part-parameter-detail'),
|
||||||
|
|
||||||
# Catch anything else
|
# Catch anything else
|
||||||
re_path(r'^.*$', ManufacturerPartParameterList.as_view(), name='api-manufacturer-part-parameter-list'),
|
re_path(r'^.*$', ManufacturerPartParameterList.as_view(), name='api-manufacturer-part-parameter-list'),
|
||||||
@ -580,7 +580,7 @@ company_api_urls = [
|
|||||||
])),
|
])),
|
||||||
|
|
||||||
re_path(r'^attachment/', include([
|
re_path(r'^attachment/', include([
|
||||||
re_path(r'^(?P<pk>\d+)/', CompanyAttachmentDetail.as_view(), name='api-company-attachment-detail'),
|
path(r'<int:pk>/', CompanyAttachmentDetail.as_view(), name='api-company-attachment-detail'),
|
||||||
re_path(r'^$', CompanyAttachmentList.as_view(), name='api-company-attachment-list'),
|
re_path(r'^$', CompanyAttachmentList.as_view(), name='api-company-attachment-list'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"""URL lookup for Company app."""
|
"""URL lookup for Company app."""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
company_urls = [
|
company_urls = [
|
||||||
|
|
||||||
# Detail URLs for a specific Company instance
|
# Detail URLs for a specific Company instance
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'^.*$', views.CompanyDetail.as_view(), name='company-detail'),
|
re_path(r'^.*$', views.CompanyDetail.as_view(), name='company-detail'),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
@ -21,11 +21,11 @@ company_urls = [
|
|||||||
|
|
||||||
manufacturer_part_urls = [
|
manufacturer_part_urls = [
|
||||||
|
|
||||||
re_path(r'^(?P<pk>\d+)/', views.ManufacturerPartDetail.as_view(template_name='company/manufacturer_part.html'), name='manufacturer-part-detail'),
|
path(r'<int:pk>/', views.ManufacturerPartDetail.as_view(template_name='company/manufacturer_part.html'), name='manufacturer-part-detail'),
|
||||||
]
|
]
|
||||||
|
|
||||||
supplier_part_urls = [
|
supplier_part_urls = [
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part.html'), name='supplier-part-detail'),
|
re_path('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part.html'), name='supplier-part-detail'),
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import FieldError, ValidationError
|
from django.core.exceptions import FieldError, ValidationError
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from rest_framework import filters
|
from rest_framework import filters
|
||||||
@ -370,7 +370,7 @@ label_api_urls = [
|
|||||||
# Stock item labels
|
# Stock item labels
|
||||||
re_path(r'stock/', include([
|
re_path(r'stock/', include([
|
||||||
# Detail views
|
# Detail views
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'print/?', StockItemLabelPrint.as_view(), name='api-stockitem-label-print'),
|
re_path(r'print/?', StockItemLabelPrint.as_view(), name='api-stockitem-label-print'),
|
||||||
re_path(r'^.*$', StockItemLabelDetail.as_view(), name='api-stockitem-label-detail'),
|
re_path(r'^.*$', StockItemLabelDetail.as_view(), name='api-stockitem-label-detail'),
|
||||||
])),
|
])),
|
||||||
@ -382,7 +382,7 @@ label_api_urls = [
|
|||||||
# Stock location labels
|
# Stock location labels
|
||||||
re_path(r'location/', include([
|
re_path(r'location/', include([
|
||||||
# Detail views
|
# Detail views
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'print/?', StockLocationLabelPrint.as_view(), name='api-stocklocation-label-print'),
|
re_path(r'print/?', StockLocationLabelPrint.as_view(), name='api-stocklocation-label-print'),
|
||||||
re_path(r'^.*$', StockLocationLabelDetail.as_view(), name='api-stocklocation-label-detail'),
|
re_path(r'^.*$', StockLocationLabelDetail.as_view(), name='api-stocklocation-label-detail'),
|
||||||
])),
|
])),
|
||||||
@ -394,7 +394,7 @@ label_api_urls = [
|
|||||||
# Part labels
|
# Part labels
|
||||||
re_path(r'^part/', include([
|
re_path(r'^part/', include([
|
||||||
# Detail views
|
# Detail views
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'^print/', PartLabelPrint.as_view(), name='api-part-label-print'),
|
re_path(r'^print/', PartLabelPrint.as_view(), name='api-part-label-print'),
|
||||||
re_path(r'^.*$', PartLabelDetail.as_view(), name='api-part-label-detail'),
|
re_path(r'^.*$', PartLabelDetail.as_view(), name='api-part-label-detail'),
|
||||||
])),
|
])),
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
- Display / Create / Edit / Delete SupplierPart
|
- Display / Create / Edit / Delete SupplierPart
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ part_urls = [
|
|||||||
re_path(r'^import-api/', views.PartImportAjax.as_view(), name='api-part-import'),
|
re_path(r'^import-api/', views.PartImportAjax.as_view(), name='api-part-import'),
|
||||||
|
|
||||||
# Individual part using pk
|
# Individual part using pk
|
||||||
re_path(r'^(?P<pk>\d+)/', include(part_detail_urls)),
|
path(r'<int:pk>/', include(part_detail_urls)),
|
||||||
|
|
||||||
# Part category
|
# Part category
|
||||||
re_path(r'^category/', include(category_urls)),
|
re_path(r'^category/', include(category_urls)),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""API for the plugin app."""
|
"""API for the plugin app."""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from rest_framework import filters, permissions, status
|
from rest_framework import filters, permissions, status
|
||||||
@ -255,7 +255,7 @@ plugin_api_urls = [
|
|||||||
])),
|
])),
|
||||||
|
|
||||||
# Detail views for a single PluginConfig item
|
# Detail views for a single PluginConfig item
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
re_path(r'^settings/(?P<key>\w+)/', PluginSettingDetail.as_view(), name='api-plugin-setting-detail-pk'),
|
re_path(r'^settings/(?P<key>\w+)/', PluginSettingDetail.as_view(), name='api-plugin-setting-detail-pk'),
|
||||||
re_path(r'^activate/', PluginActivate.as_view(), name='api-plugin-detail-activate'),
|
re_path(r'^activate/', PluginActivate.as_view(), name='api-plugin-detail-activate'),
|
||||||
re_path(r'^.*$', PluginDetail.as_view(), name='api-plugin-detail'),
|
re_path(r'^.*$', PluginDetail.as_view(), name='api-plugin-detail'),
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"""URL lookup for Stock app."""
|
"""URL lookup for Stock app."""
|
||||||
|
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
from stock import views
|
from stock import views
|
||||||
|
|
||||||
location_urls = [
|
location_urls = [
|
||||||
|
|
||||||
re_path(r'^(?P<pk>\d+)/', include([
|
path(r'<int:pk>/', include([
|
||||||
# Anything else - direct to the location detail view
|
# Anything else - direct to the location detail view
|
||||||
re_path('^.*$', views.StockLocationDetail.as_view(), name='stock-location-detail'),
|
re_path('^.*$', views.StockLocationDetail.as_view(), name='stock-location-detail'),
|
||||||
])),
|
])),
|
||||||
|
Reference in New Issue
Block a user