iFunction
iFunction

Reputation: 1268

Django unable to change name for url pattern

I'm trying to refactor some of my code so that it is consistent, i.e. the name:

path('create_project', ProjectCreateView.as_view(), name='create-project'),

I have also changed it in my template:

<a href="create-project">
   <img src="{% static 'project_portal/image/icon_add_circle.png' %}" alt="Add" width="32">
</a>

but now I get the following:

Page not found (404)
Request Method:     GET
Request URL:    http://127.0.0.1:8000/si/create-project/
Raised by:  project_portal.views.ProjectDetailView

How can changing a "_" to "-" break the code?

Upvotes: 0

Views: 50

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599630

You didn't actually use the name.

<a href="{% url "create-project" %}">

Upvotes: 2

Related Questions