mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 04:56:45 +00:00
parent
0404d5c137
commit
a3ffc01d88
@ -1033,11 +1033,6 @@ def inheritors(
|
|||||||
return subcls
|
return subcls
|
||||||
|
|
||||||
|
|
||||||
def is_ajax(request):
|
|
||||||
"""Check if the current request is an AJAX request."""
|
|
||||||
return request.headers.get('x-requested-with') == 'XMLHttpRequest'
|
|
||||||
|
|
||||||
|
|
||||||
def pui_url(subpath: str) -> str:
|
def pui_url(subpath: str) -> str:
|
||||||
"""Return the URL for a PUI subpath."""
|
"""Return the URL for a PUI subpath."""
|
||||||
if not subpath.startswith('/'):
|
if not subpath.startswith('/'):
|
||||||
|
@ -6,7 +6,6 @@ from datetime import timedelta
|
|||||||
from django.core.exceptions import ValidationError as DjangoValidationError
|
from django.core.exceptions import ValidationError as DjangoValidationError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import F, Q
|
from django.db.models import F, Q
|
||||||
from django.http import JsonResponse
|
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@ -35,13 +34,7 @@ from InvenTree.filters import (
|
|||||||
SEARCH_ORDER_FILTER_ALIAS,
|
SEARCH_ORDER_FILTER_ALIAS,
|
||||||
InvenTreeDateFilter,
|
InvenTreeDateFilter,
|
||||||
)
|
)
|
||||||
from InvenTree.helpers import (
|
from InvenTree.helpers import extract_serial_numbers, generateTestKey, isNull, str2bool
|
||||||
extract_serial_numbers,
|
|
||||||
generateTestKey,
|
|
||||||
is_ajax,
|
|
||||||
isNull,
|
|
||||||
str2bool,
|
|
||||||
)
|
|
||||||
from InvenTree.mixins import (
|
from InvenTree.mixins import (
|
||||||
CreateAPI,
|
CreateAPI,
|
||||||
CustomRetrieveUpdateDestroyAPI,
|
CustomRetrieveUpdateDestroyAPI,
|
||||||
@ -1465,8 +1458,7 @@ class StockTrackingList(DataExportViewMixin, ListAPI):
|
|||||||
|
|
||||||
if page is not None:
|
if page is not None:
|
||||||
return self.get_paginated_response(data)
|
return self.get_paginated_response(data)
|
||||||
if is_ajax(request):
|
|
||||||
return JsonResponse(data, safe=False)
|
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user