django template NoReverseMatch
I had two functions create and update in the file views, update takes one
argument and create does not. I decided to turn them into only one
function update_create because they are not that different. views.py
def update_create(request, id=None):
urls.py:
url(r'^(\d+)/update/$|create/$', update_create, name='update_create'),
templates/list.html
<a href="{% url 'update_create' %}">Create a new event</a>
I got this error with the version above:
NoReverseMatch at /agenda/list/
Reverse for 'update_create' with arguments '()' and keyword arguments
'{}' not found.
But when I do this (I add an argument) it works: templates/list.html
<a href="{% url 'update_create' 1 %}">Create a new event</a>
What's happening? Thanks in advance.
No comments:
Post a Comment