I can't understand this NoReverseMatch

16 views
Skip to first unread message

phep

unread,
Apr 20, 2017, 7:51:51 AM4/20/17
to django...@googlegroups.com
Hi all,

I just got this (slightly reformated for readability) exception I really
can't explain:

8<------------
NoReverseMatch at /saule/taiga/import/1/display

Reverse for 'display_taiga_report' with arguments '()' and keyword arguments

'{'report_id': '1', 'option': 'error_view'}'

not found.

2 pattern(s) tried:
['saule/taiga/import/(?P<report_id>[0-9]+)/display/(?P<option>[a-z]+)$',
'saule/taiga/import/(?P<report_id>[0-9]+)/display$']
8<------------

Why would the first pattern does not match since it has the 2 arguments?

This is my (part of) my urls.py:

8<------------
from django.conf.urls import url

from saule import views

app_name = 'saule'
urlpatterns = [
# index
url(r'^$', views.index, name='index'),
# Display reports
# ... [ stuff removed ] ...
url(
r'^taiga/import/(?P<report_id>[0-9]+)/display$',
views.display_taiga_report,
name='display_taiga_report'
),
url(
r'^taiga/import/(?P<report_id>[0-9]+)/display/(?P<option>[a-z]+)$',
views.display_taiga_report,
name='display_taiga_report'
),
# ... [ more stuff removed ] ...
]
8<------------

Then the bailing template line (there, the report_id variable is correctly
set to 1, as can be seen in the exception message):

8<------------
<a href="{% url 'saule:display_taiga_report' report_id=report_id
option='error_view' %}">
8<------------

Thanks in advance,

phep

phep

unread,
Apr 20, 2017, 7:57:16 AM4/20/17
to django...@googlegroups.com
Sorry for the noise, guys, always the same song... Why this stupid errors
never show up before you hit "send"....

Melvyn Sopacua

unread,
Apr 20, 2017, 7:58:59 AM4/20/17
to django...@googlegroups.com

Hi,

 

On Thursday 20 April 2017 13:49:48 phep wrote:

 

> 8<------------

> NoReverseMatch at /saule/taiga/import/1/display

>

> Reverse for 'display_taiga_report' with arguments '()' and keyword

> arguments

>

> '{'report_id': '1', 'option': 'error_view'}'

because underscore

 

>

> ['saule/taiga/import/(?P<report_id>[0-9]+)/display/(?P<option>[a-z]+)

 

is not in [a-z]+

 

 

--

Melvyn Sopacua

Reply all
Reply to author
Forward
0 new messages