Change django/middleware/csrf.py (line 365)
if request.method == "POST":
To
if request.method != "GET":
--
Ticket URL: <https://code.djangoproject.com/ticket/35062>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
Thanks for this report, however if you're using a custom middleware to
convert POST to PUT/PATCH/DELETE then you can also use your own
`CsrfViewMiddleware` subclass to handle them. It doesn't need to be handle
by Django itself. We don't usually include workarounds for niche edge
cases.
--
Ticket URL: <https://code.djangoproject.com/ticket/35062#comment:1>
* cc: I-MirzaBaig (added)
Comment:
Has it been solved?
--
Ticket URL: <https://code.djangoproject.com/ticket/35062#comment:2>
Comment (by Peter Jones):
I've enhanced my middleware to address both the Request method limitation
and the CSRF header issue for HTML forms. Despite these improvements, I
believe Django, as 'the web framework for perfectionists,' should
inherently offer better support for scenarios where JavaScript is disabled
in the browser. Prioritizing accessibility and functionality in a no-
JavaScript environment aligns with the high standards Django sets for web
development.
https://www.reddit.com/r/webdev/comments/mfnxnj/why_your_website_should_work_without_javascript/
--
Ticket URL: <https://code.djangoproject.com/ticket/35062#comment:3>
Comment (by Natalia Bidart):
Hello Peter!
One one hand, if you disagree with the resolution, you can alternatively
propose and discuss the idea/request with the community and gain
consensus. To do that, you could start a new conversation on the
[https://forum.djangoproject.com/c/internals/5 Django Forum], where you'll
reach a wider audience and potentially get extra feedback.
On the other hand, it would be important to explain in detail how the
change you suggest affects working with/without Javascript enabled. I have
multiple sites where javascript is not required at all and they do not
need this change.
--
Ticket URL: <https://code.djangoproject.com/ticket/35062#comment:4>