Skip to content

Commit affcdd1

Browse files
author
oko-x
committed
fix(list): added additional header to distinguish tabulator calls
1 parent e529126 commit affcdd1

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-smartbase-admin"
3-
version = "0.2.17"
3+
version = "0.2.18"
44
description = ""
55
authors = ["SmartBase <[email protected]>"]
66
readme = "README.md"

src/django_smartbase_admin/actions/admin_action_list.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ def __init__(
4545
) -> None:
4646
super().__init__(view, request)
4747
if all_params is None:
48-
if request.request_data.request_method == "GET":
49-
self.all_params = json.loads(
50-
request.request_data.request_get.get(BASE_PARAMS_NAME, "{}")
51-
)
52-
if request.request_data.request_method == "POST":
53-
self.all_params = json.loads(request.body)
48+
self.all_params = json.loads(
49+
request.request_data.request_get.get(BASE_PARAMS_NAME, "{}")
50+
)
51+
if (
52+
request.headers.get("X-TabulatorRequest", None) == "true"
53+
and request.request_data.request_method == "POST"
54+
):
55+
try:
56+
self.all_params = json.loads(request.body)
57+
except json.JSONDecodeError:
58+
pass
5459
else:
5560
self.all_params = all_params
5661
if not self.all_params:

src/django_smartbase_admin/static/sb_admin/src/js/table.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ class SBAdminTable {
257257
this.tableHistoryEnabled = false
258258
}
259259
tabulatorOptions['ajaxConfig']['headers']['X-CSRFToken'] = window.csrf_token
260+
tabulatorOptions['ajaxConfig']['headers']['X-TabulatorRequest'] = true
260261
tabulatorOptions = this.callModuleAction('modifyTabulatorOptions', tabulatorOptions)
261262
this.tabulator = new Tabulator(this.tableElSelector, tabulatorOptions)
262263
document.addEventListener("SBAdminReloadTableData", function () {

0 commit comments

Comments
 (0)