URL names must be unique otherwise reverse('url_name') and {% url 'url_name' %} will link to the "wrong" page half of the time.

Django uses the URL name to generate the view's URL. Like a dict, only one entry can exist for a given "key".

If our GitHub code review bot spots this issue in your pull request it gives this advice:

django-doctorbotsuggested changes just now
urls.py
1
+
urlpatterns = [
2
+
    path('', Home.as_view(), name="index"),
3
+
    path('index/', Index.as_view(), name="index"),

URL names must be unique otherwise reverse('url_name') and {% url 'url_name' %} will link to the "wrong" page half of the time.

Read more
Suggested changes
-
    path('index/', Index.as_view(), name="index"),
+
    path('index/', Index.as_view(), name="index-list"),
Commit suggestion
4
+
]
Update urls.py

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.