From 6edef7b77344ae28446f26cb48b1e6a0fe5bb381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BCchner?= Date: Thu, 12 May 2022 17:32:44 +0200 Subject: [PATCH] Bug: is_ajax() is deprecated --- DDBmeme/ddbmeme/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DDBmeme/ddbmeme/views.py b/DDBmeme/ddbmeme/views.py index 30ef7b2..fc43e2a 100755 --- a/DDBmeme/ddbmeme/views.py +++ b/DDBmeme/ddbmeme/views.py @@ -17,9 +17,11 @@ class Search(CreateView): model = Search fields = ('query', 'toptext', 'bottomtext',) +def is_ajax(request): + return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest' def autocompletemodel(request): - if not request.is_ajax(): + if not is_ajax(request): return api_key = os.environ.get('DDB_API_KEY', '') @@ -81,7 +83,7 @@ def autocompletemodel(request): def maketextmodel(request): - if not request.is_ajax(): + if not is_ajax(request): return toptext = replacereserved(request.GET.get('toptext', None))