[Answered ]-Django no reverse match error but i have optional view parameters

2👍

You need to add pk argument.

<a href="{% url 'journals:entry' action='add'  day_number=journal.day_number pk=... %}" >

If you want to make pk optional, modify the pattern as follow:

url(r'^day/(?P<day_number>\d+)/(?P<action>add|edit|delete)/(?P<pk>\d+)?/$',
    views.entry, name='entry'),

Leave a comment