summaryrefslogtreecommitdiff
path: root/django/http/request.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2020-01-23 18:01:41 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-27 08:54:32 +0100
commite348ab0d4382b0d7cb0cab9d1261c916c3d0ce6c (patch)
tree887f38c19afa9512965b36f276b7499fb54f8dad /django/http/request.py
parent7fa0fa45c5786619409036c5adce52ff6189b0ac (diff)
downloaddjango-e348ab0d4382b0d7cb0cab9d1261c916c3d0ce6c.tar.gz
Fixed #30997 -- Deprecated HttpRequest.is_ajax().
Diffstat (limited to 'django/http/request.py')
-rw-r--r--django/http/request.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/http/request.py b/django/http/request.py
index 790e4546d7..192ade4de6 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -1,6 +1,7 @@
import cgi
import codecs
import copy
+import warnings
from io import BytesIO
from itertools import chain
from urllib.parse import quote, urlencode, urljoin, urlsplit
@@ -15,6 +16,7 @@ from django.http.multipartparser import MultiPartParser, MultiPartParserError
from django.utils.datastructures import (
CaseInsensitiveMapping, ImmutableList, MultiValueDict,
)
+from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.encoding import escape_uri_path, iri_to_uri
from django.utils.functional import cached_property
from django.utils.http import is_same_domain, limited_parse_qsl
@@ -256,6 +258,11 @@ class HttpRequest:
return self.scheme == 'https'
def is_ajax(self):
+ warnings.warn(
+ 'request.is_ajax() is deprecated. See Django 3.1 release notes '
+ 'for more details about this deprecation.',
+ RemovedInDjango40Warning,
+ )
return self.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
@property