diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-26 15:07:19 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-13 18:08:06 +0200 |
commit | f83a1ca1190d2357f668ea182c7b20181fe117e7 (patch) | |
tree | b9f0095cffd72449c2d261f50b0427426a55852a /ishtar_common/views.py | |
parent | 62e6c83e6d4c901a7c511a195e696ee81b29eba8 (diff) | |
download | Ishtar-f83a1ca1190d2357f668ea182c7b20181fe117e7.tar.bz2 Ishtar-f83a1ca1190d2357f668ea182c7b20181fe117e7.zip |
♻️ django 3.2 deprecation: replace is_ajax by custom method
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r-- | ishtar_common/views.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py index d46cd3323..73511c03e 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -92,6 +92,7 @@ from ishtar_common.utils import ( put_session_message, get_model_by_slug, human_date, + is_xmlhttprequest ) from ishtar_common.widgets import JQueryAutoComplete from ishtar_common import tasks @@ -770,7 +771,7 @@ def unpin(request, item_type, cascade=False): def update_current_item(request, item_type=None, pk=None): if not item_type or not pk: - if not request.is_ajax() and not request.method == "POST": + if not is_xmlhttprequest(request) and not request.method == "POST": raise Http404 item_type = request.POST["item"] if "value" in request.POST and "item" in request.POST: @@ -841,7 +842,8 @@ def pin_search(request, item_type): item_type = "administrativeact" key = "pin-search-" + item_type if not item_type or not ( - request.is_ajax() and request.method == "POST" and "value" in request.POST + is_xmlhttprequest(request) and request.method == "POST" + and "value" in request.POST ): raise Http404 request.session[key] = request.POST["value"] |