mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Fixed #30997 -- Deprecated HttpRequest.is_ajax().
This commit is contained in:
parent
7fa0fa45c5
commit
e348ab0d43
6 changed files with 31 additions and 1 deletions
|
@ -44,6 +44,8 @@ details on these changes.
|
|||
|
||||
* The ``django-admin.py`` entry point will be removed.
|
||||
|
||||
* The ``HttpRequest.is_ajax()`` method will be removed.
|
||||
|
||||
See the :ref:`Django 3.1 release notes <deprecated-features-3.1>` for more
|
||||
details on these changes.
|
||||
|
||||
|
|
|
@ -431,6 +431,8 @@ Methods
|
|||
|
||||
.. 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.
|
||||
|
|
|
@ -609,7 +609,7 @@ Django 1.4 also includes several smaller improvements worth noting:
|
|||
* A new, plain-text, version of the HTTP 500 status code internal error page
|
||||
served when :setting:`DEBUG` is ``True`` is now sent to the client when
|
||||
Django detects that the request has originated in JavaScript code.
|
||||
(:meth:`~django.http.HttpRequest.is_ajax` is used for this.)
|
||||
(``is_ajax()`` is used for this.)
|
||||
|
||||
Like its HTML counterpart, it contains a collection of different
|
||||
pieces of information about the state of the application.
|
||||
|
|
|
@ -471,6 +471,13 @@ Miscellaneous
|
|||
* The ``django-admin.py`` entry point is deprecated in favor of
|
||||
``django-admin``.
|
||||
|
||||
* The ``HttpRequest.is_ajax()`` method is deprecated as it relied on a
|
||||
jQuery-specific way of signifying AJAX calls, while the current usage tends
|
||||
to use the ``fetch()`` JavaScript API. Depending on your use case, you can
|
||||
either write your own AJAX detection method, or use the new
|
||||
:meth:`.HttpRequest.accepts` method if your code depends on the client
|
||||
``Accept`` HTTP header.
|
||||
|
||||
.. _removed-features-3.1:
|
||||
|
||||
Features removed in 3.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue