# Http method routing

**URL:** <https://forum.djangoproject.com/t/http-method-routing/43130>\
**Category:** Django Internals\
**Created:** [October 9, 2025, 1:57pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130 "2025-10-09T13:57:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![massover](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/massover/32/1792_2.png) [@massover](https://forum.djangoproject.com/u/massover)\
**Post date:** [October 9, 2025, 1:57pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130/1 "2025-10-09T13:57:39Z")

</div>

This doesn’t work right now because the first url pattern will always resolve.

```python
urlpatterns = [
    path('pet', views.pet_list_view),
    path('pet', views.pet_create_view),
]

```

I understand that we can solve this built in right now by routing on class methods.

```python
urlpatterns = [
    path('pet', views.PetView.as_view())
]

```

Also, it can be solved functionally by making our own “routing” view:

```python
urlpatterns = [
    path('pet', list_router(get=views.pet_list_view, post=views.pet_create_view),
]

```

It also seems like it would be nice if this “just worked” (or some other chosen syntax):

```python
urlpatterns = [
    path('pet', views.pet_list_view, methods=['GET'],),
    path('pet', views.pet_create_view, methods=['POST']),
]

```

I found some prior tickets/conversation, but nothing really seems to suggest there’s a blocker:

> **[\#33780 (Add http method argument to the URLResolver)
          – Django](https://code.djangoproject.com/ticket/33780)**

> **[\#2784 (extend URL resolver support for HTTP Methods)
          – Django](https://code.djangoproject.com/ticket/2784)**

> **[Extend URL resolver support for HTTP Methods / REST support](https://groups.google.com/g/django-developers/c/FQVrKXkYAig)**

I think this would be a nice addition to django especially for building some simple json apis. Looking at the UrlResolver code, it seems like not the type of code to try and implement as a “django app”. Thoughts?

---

<div class="post-metadata">

**Author:** ![doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@doom](https://forum.djangoproject.com/u/doom)\
**Post date:** [October 9, 2025, 2:17pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130/2 "2025-10-09T14:17:18Z")

</div>

For completeness: another way that you would do it right now, without CBV or routers, would be to create a list\_or\_create view and check request.method and then branch off.

---

<div class="post-metadata">

**Author:** ![tom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/tom/32/6818_2.png) [@tom](https://forum.djangoproject.com/u/tom)\
**Post date:** [October 10, 2025, 8:09pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130/3 "2025-10-10T20:09:50Z")

</div>

I would personally like to have a well-supported way of doing this that isn’t making an intermediate view or using a CBV. The syntax also seems okay to me. I would suggest adding this to the [new-features repo](https://github.com/django/new-features/issues) as that’s where most discussion of new features happens now.

---

<div class="post-metadata">

**Author:** ![massover](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/massover/32/1792_2.png) [@massover](https://forum.djangoproject.com/u/massover)\
**Post date:** [October 11, 2025, 3:44pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130/4 "2025-10-11T15:44:44Z")

</div>

new feature ticket [opened](https://github.com/django/new-features/issues/87). I also don’t expect someone else to do this; I am happy to implement it. Making a change to url routing seemed like such a fundamental thing that I wanted some +1s and some core dev support before touching a pr.

---

<div class="post-metadata">

**Author:** ![massover](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/massover/32/1792_2.png) [@massover](https://forum.djangoproject.com/u/massover)\
**Post date:** [November 23, 2025, 11:47pm UTC](https://forum.djangoproject.com/t/http-method-routing/43130/5 "2025-11-23T23:47:38Z")

</div>

I want ahead and created a draft [DEP](https://github.com/django/deps/pull/104/files) for this along with a reference pr and an example project using the new code.
