[Django]-Django NoReverseMatch

43👍

✅

The problem is in the way you include the auth URLs in the main one.
Because you use both ^ and $, only the empty string matches. Drop the $.

0👍

I had html anchor tag: <a href="{% url 'url-name' url=someUUID %}">

in my urls.py

...

path('some_name/<slug:slug>/', views.someDetailView.as_view(), name='url-name'),

...

Solution for this:

This: <a href="{% url 'url-name' someUUID %}">

Or this: <a href="{% url 'url-name' slug=someUUID %}">

not: <a href="{% url 'url-name' url=someUUID %}">

DetailView uses slug_field = 'someUUIDField'


For some reason I wrote url instead of slug. Now it works.

Maybe you wrote wrong also, make sure you use slug=, if you use <slug:slug>.

Leave a comment