Form pot URL not defined in URLconf

I have a form that is on the URL: http://127.0.0.1:8000/disciplineReport/1/ where 1 is the primary key of the object I'm editing.

detail.html:

<form method="post" id="edit-form" action="{% url 'disciplineReport:saveDiscipline' 
doctor.id %}}">

urls.py:

urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
path('<int:pk>/saveDiscipline/', views.SaveDiscipline, name='saveDiscipline'),
]

Error:

Using the URLconf defined in program_history_reports.urls, Django tried these URL patterns, in this order:

disciplineReport/ [name='index'] disciplineReport/ int:pk/ [name='detail'] disciplineReport/ int:pk/saveDiscipline/ [name='saveDiscipline'] admin/ The current path, disciplineReport/1/saveDiscipline/}, didn't match any of these.

What am I missing here? it seems like the URL matches the 3rd pattern...

before urlpatterns write this:

 app_name = 'disciplineReport'
Back to Top