diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-26 15:07:19 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-07-21 15:07:41 +0200 |
commit | 18556dec8d2989f715d2251342aa4368fda857c8 (patch) | |
tree | b355300b8710c45b1f86795793ea8224b91ce6c9 /ishtar_common/views.py | |
parent | f4a1bd2de96dfc246bd89c8849f1f6188616cd9c (diff) | |
download | Ishtar-18556dec8d2989f715d2251342aa4368fda857c8.tar.bz2 Ishtar-18556dec8d2989f715d2251342aa4368fda857c8.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 50c16419c..e37136bcd 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -93,6 +93,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 @@ -771,7 +772,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: @@ -842,7 +843,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"] |