Reverse for 'edit-todo' with arguments '('',)' not found. 1 pattern(s) tried: ['edit\\-todo/(?P<id>[0-9]+)/$']

I've dug around the internet and can't find a solution. Please help me lovely people of the internet.

In my views.py

@login_required
def edit_todo(request, pk):
    usertodo = get_object_or_404(Todo, pk=pk)
    return HttpResponse('test')

In my urls.py

urlpatterns = [
    ...
    path('edit-todo/<int:id>/', views.edit_todo, name='edit-todo'),
    path('test/<int:pk>/', views.edit_todo, name='test'),
    ...
]

In my template/component that's included

<form hx-encoding="multipart/form-data" hx-post="{% url 'core:edit-todo' tododetail.todo.id %}" hx-target="#todo-list" method="post">

tododetail.todo.id is called because I've got an ordering table which has todo & user as foreign keys.

When accessing the view directly using a test URL it works

test url

Back to Top