mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Use int PK instead of regex string in API endpoints (#9399)
* Convert company api endpoints to use int PK instead of regex string * Convert additional path PK strings to ints
This commit is contained in:
parent
7f5a447769
commit
2457dfee70
@ -1,13 +1,16 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 328
|
INVENTREE_API_VERSION = 329
|
||||||
|
|
||||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||||
|
|
||||||
|
|
||||||
INVENTREE_API_TEXT = """
|
INVENTREE_API_TEXT = """
|
||||||
|
|
||||||
|
v329 - 2025-03-30 : https://github.com/inventree/InvenTree/pull/9399
|
||||||
|
- Convert url path regex-specified PKs to int
|
||||||
|
|
||||||
v228 - 2025-03-29 : https://github.com/inventree/InvenTree/pull/9407
|
v228 - 2025-03-29 : https://github.com/inventree/InvenTree/pull/9407
|
||||||
- Updates schema to include paging arguments
|
- Updates schema to include paging arguments
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Provides a JSON API for the Company app."""
|
"""Provides a JSON API for the Company app."""
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.urls import include, path, re_path
|
from django.urls import include, path
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from django_filters import rest_framework as rest_filters
|
from django_filters import rest_framework as rest_filters
|
||||||
@ -511,8 +511,8 @@ manufacturer_part_api_urls = [
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/',
|
||||||
include([
|
include([
|
||||||
path(
|
path(
|
||||||
'metadata/',
|
'metadata/',
|
||||||
@ -533,8 +533,8 @@ manufacturer_part_api_urls = [
|
|||||||
|
|
||||||
|
|
||||||
supplier_part_api_urls = [
|
supplier_part_api_urls = [
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/',
|
||||||
include([
|
include([
|
||||||
path(
|
path(
|
||||||
'metadata/',
|
'metadata/',
|
||||||
@ -557,8 +557,8 @@ company_api_urls = [
|
|||||||
path(
|
path(
|
||||||
'price-break/',
|
'price-break/',
|
||||||
include([
|
include([
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/',
|
||||||
SupplierPriceBreakDetail.as_view(),
|
SupplierPriceBreakDetail.as_view(),
|
||||||
name='api-part-supplier-price-detail',
|
name='api-part-supplier-price-detail',
|
||||||
),
|
),
|
||||||
@ -569,8 +569,8 @@ company_api_urls = [
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/',
|
||||||
include([
|
include([
|
||||||
path(
|
path(
|
||||||
'metadata/',
|
'metadata/',
|
||||||
@ -584,8 +584,8 @@ company_api_urls = [
|
|||||||
path(
|
path(
|
||||||
'contact/',
|
'contact/',
|
||||||
include([
|
include([
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/',
|
||||||
include([
|
include([
|
||||||
path(
|
path(
|
||||||
'metadata/',
|
'metadata/',
|
||||||
|
@ -4,7 +4,7 @@ import functools
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from django.db.models import Count, F, Q
|
from django.db.models import Count, F, Q
|
||||||
from django.urls import include, path, re_path
|
from django.urls import include, path
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from django_filters import rest_framework as rest_filters
|
from django_filters import rest_framework as rest_filters
|
||||||
@ -2180,10 +2180,8 @@ part_api_urls = [
|
|||||||
'thumbs/',
|
'thumbs/',
|
||||||
include([
|
include([
|
||||||
path('', PartThumbs.as_view(), name='api-part-thumbs'),
|
path('', PartThumbs.as_view(), name='api-part-thumbs'),
|
||||||
re_path(
|
path(
|
||||||
r'^(?P<pk>\d+)/?',
|
'<int:pk>/', PartThumbsUpdate.as_view(), name='api-part-thumbs-update'
|
||||||
PartThumbsUpdate.as_view(),
|
|
||||||
name='api-part-thumbs-update',
|
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
@ -4,7 +4,7 @@ import datetime
|
|||||||
|
|
||||||
from django.contrib.auth import get_user, login
|
from django.contrib.auth import get_user, login
|
||||||
from django.contrib.auth.models import Group, User
|
from django.contrib.auth.models import Group, User
|
||||||
from django.urls import include, path, re_path
|
from django.urls import include, path
|
||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
from django.views.generic.base import RedirectView
|
from django.views.generic.base import RedirectView
|
||||||
|
|
||||||
@ -395,12 +395,10 @@ user_urls = [
|
|||||||
path(
|
path(
|
||||||
'group/',
|
'group/',
|
||||||
include([
|
include([
|
||||||
re_path(
|
path('<int:pk>/', GroupDetail.as_view(), name='api-group-detail'),
|
||||||
r'^(?P<pk>[0-9]+)/?$', GroupDetail.as_view(), name='api-group-detail'
|
|
||||||
),
|
|
||||||
path('', GroupList.as_view(), name='api-group-list'),
|
path('', GroupList.as_view(), name='api-group-list'),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
re_path(r'^(?P<pk>[0-9]+)/?$', UserDetail.as_view(), name='api-user-detail'),
|
path('<int:pk>/', UserDetail.as_view(), name='api-user-detail'),
|
||||||
path('', UserList.as_view(), name='api-user-list'),
|
path('', UserList.as_view(), name='api-user-list'),
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user