mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #30997 -- Removed HttpRequest.is_ajax() per deprecation timeline.
This commit is contained in:
@@ -425,23 +425,6 @@ Methods
|
||||
<django.views.decorators.vary.vary_on_headers>` so that the responses are
|
||||
properly cached.
|
||||
|
||||
.. method:: HttpRequest.is_ajax()
|
||||
|
||||
.. deprecated:: 3.1
|
||||
|
||||
Returns ``True`` if the request was made via an ``XMLHttpRequest``, by
|
||||
checking the ``HTTP_X_REQUESTED_WITH`` header for the string
|
||||
``'XMLHttpRequest'``. Most modern JavaScript libraries send this header.
|
||||
If you write your own ``XMLHttpRequest`` call (on the browser side), you'll
|
||||
have to set this header manually if you want ``is_ajax()`` to work.
|
||||
|
||||
If a response varies on whether or not it's requested via AJAX and you are
|
||||
using some form of caching like Django's :mod:`cache middleware
|
||||
<django.middleware.cache>`, you should decorate the view with
|
||||
:func:`vary_on_headers('X-Requested-With')
|
||||
<django.views.decorators.vary.vary_on_headers>` so that the responses are
|
||||
properly cached.
|
||||
|
||||
.. method:: HttpRequest.read(size=None)
|
||||
.. method:: HttpRequest.readline()
|
||||
.. method:: HttpRequest.readlines()
|
||||
|
||||
@@ -275,3 +275,5 @@ to remove usage of these features.
|
||||
* The ``django.db.models.query_utils.InvalidQuery`` exception class is removed.
|
||||
|
||||
* The ``django-admin.py`` entry point is removed.
|
||||
|
||||
* The ``HttpRequest.is_ajax()`` method is removed.
|
||||
|
||||
Reference in New Issue
Block a user