I want to pass the argument to the function through the url. But I am getting an error as:
Reverse for 'combodetails' not found. 'combodetails' is not a valid view function or pattern name.
urls.py:
app_name = "dashboard"
urlpatterns = [
path('combodetails/<int:id>/', combodetails, name="combodetails"),
]
views.py:
def combodetails(request, id):
print(id)
return render(request, "dashboard/combodetails.html", context={})
.html:
<a href="{% url 'dashboard:combodetails' model.id %}" >
I have used the same method in other functions and they are working fine. But here I don't know what's happening.
In project.urls.py :
urlpatterns = [
path('dashboard/', include('dashboard.urls', namespace="dashboard"),),
]
CodePudding user response:
please try this:
<a href="{% url 'combodetails' model.id %}" >
CodePudding user response:
I have commented on some parts of code in the HTML file using html comment style i.e. <!-- -->
where I have used URL without argument that's why I am getting errors. I have removed the commented section from my file and now it's working.