I am trying to redirect an link from app to another page view function. But after pointing the page correctly I am getting NoReverseMatch Found error on apps main page which haves no connection to it.
This is urls.py of main Project urls.py
urlpatterns = [
path('', views.home, name="home"),
path('admin/', admin.site.urls),
path('teacher/', include('teacher.urls')),
path('student/', include('student.urls')),
]
This is urls.py for respective app which is teacher urls.py
urlpatterns = [
path('', views.index, name="index"),
path(r'^detailed/(?P<reportid>\d{0,4})/$', views.detailed, name="detailed"),
]
I am also including views.py as error is pointing at view.py views.py
def index(request):
return render(request, 'teacher/report.html')
def detailed(request, reportid):
weeklyr = wreport.objects.all()
dailyr = dreport.objects.all()
split = SplitOfWeek.objects.all()
return render(request, 'teacher/detailed.html')
I have tried adding r'^teacher/$'
at main urls.py and r'^$'
at urls.py of teacher app but after adding it shows there is url found for teacher.
This is the detailed error message:
Reverse for 'detailed' with no arguments not found. 1 pattern(s) tried: ['teacher/\\^detailed/\\(\\?P(?P<reportid>[^/]+)\\\\d\\{0,4\\}\\)/\\$$']