From ae5bd7720b27ebf3790c50d1b1e6c95edbc089cf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 26 Mar 2025 15:07:19 +0100 Subject: ♻️ django 3.2 deprecation: replace is_ajax by custom method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ishtar_common/views.py') 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"] -- cgit v1.2.3