Ok, I've been banging my head against this for 30+ minutes, so here I am on stack overflow.
I've got in a template:
{% if user.is_authenticated %}
<a href="{% url 'admin' %}">
Admin
</a>
{% endif %}
And in urls.py:
urlpatterns = [
path('admin', admin.site.urls, name = 'admin'),
path('', views.index, name ='index'),
]
Yet I still get: NoReverseMatch at /
Reverse for 'admin' not found. 'admin' is not a valid view function or pattern name.
Why is that? I even tested it out, and replaced admin with index, and it redirects me to views.index. I tried replacing the name of the pattern with everything else and tried matching it with the url path as well (like it is now). No luck! Did I just break django?