Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Django 3.1 deprecated request.is_ajax() #138

@bockstaller

Description

@bockstaller

Hi there,

Running the tests on one of my projects with the beeline enabled resulted in this little gem:
[...]/venv/lib/python3.8/site-packages/beeline/middleware/django/__init__.py:100: RemovedInDjango40Warning: request.is_ajax() is deprecated. See Django 3.1 release notes for more details about this deprecation. "request.xhr": request.is_ajax(),

Citing from the release notes:

"The HttpRequest.is_ajax() method is deprecated as it relied on a jQuery-specific way of signifying AJAX calls, while current usage tends to use the JavaScript Fetch API. Depending on your use case, you can either write your own AJAX detection method, or use the new HttpRequest.accepts() method if your code depends on the client Accept HTTP header."

It will be removed with Django 4.0, so there is plenty of time to make the necessary changes. I just wanted to put in on your radar.
I am not actively using this field myself and am only starting out with Django. So I didn't prepare a pull request, because I've no clue what's the expected behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions