Skip to content

Commit

Permalink
Bug: is_ajax() is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuechner committed May 12, 2022
1 parent 64856a7 commit 6edef7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DDBmeme/ddbmeme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '')
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 6edef7b

Please sign in to comment.