#35080 closed New feature (wontfix)

Reconsideration of HTTP Method Integration in Django for Enhanced HTMX Compatibility and similar frontend expe

Reported by: code-on Owned by: nobody
Component: Uncategorized Version: dev
Severity: Normal Keywords: htmx, hx-delete, hx-post, request.POST, request.DELETE, request.PATCH
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am reaching out to propose a reconsideration of Django's current handling of HTTP methods, specifically in the context of modern web development practices and the growing adoption of libraries such as HTMX.

I understand that a similar request was previously declined (referenced in Django Ticket #12635 https://code.djangoproject.com/ticket/12635). However, the landscape of web development has significantly evolved since then. The integration of explicit HTTP methods such as DELETE, POST, PATCH, and PUT could greatly enhance Django's compatibility with HTMX and similar libraries.

At present, Django views support methods like post, get, delete, and patch. However, integrating these methods with HTMX often leads to a suboptimal experience. This is partly due to the necessity of parsing request.body to access the transmitted values. Frameworks like Django Rest Framework (DRF) and other frontend libraries provide a more direct handling of these HTTP methods.

By supporting these HTTP methods more explicitly, Django could enable cleaner and more efficient code, particularly in the context of class-based views. This change would reduce the need for creating multiple URLs and separate functions for different HTTP methods.

Als for new people to django it makes things more clear if the missing request.DELETE and request.PATCH, PUT are there.

Change History (1)

comment:1 by Mariusz Felisiak, 11 months ago

Resolution: wontfix
Status: newclosed

Thanks for this ticket, however, as far as I'm aware, you're proposing a (potentially backward incompatible) change in the way how Django handles HTTP request/response cycle. Such changes should first be discussed in detail on the Django Forum (or DevelopersMailingList), where you'll reach a wider audience and see what other think. Moreover, you should have a plan how to implement this, what kind of changes are needed, and how to implement them without violating out stability policy. Also, please follow the guidelines with regards to requesting features.

I've noticed that you also created an issue in django-htmx. For the future, I'd recommend waiting for a reply instead of creating upstream tickets.

"By supporting these HTTP methods more explicitly"

For example, I'm not really sure what do you mean by that.

Note: See TracTickets for help on using tickets.
Back to Top