I can't understand this NoReverseMatch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

I can't understand this NoReverseMatch

phep
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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/41052786-9651-157c-52a4-3a07fee6113e%40teletopie.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I can't understand this NoReverseMatch

phep
Sorry for the noise, guys, always the same song... Why this stupid errors
never show up before you hit "send"....

Le 20/04/2017 à 13:49, phep a écrit :

> 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
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/058ef750-193d-1382-5aee-6788457b7351%40teletopie.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I can't understand this NoReverseMatch

Melvyn Sopacua
In reply to this post by phep

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7538265.XJWtvR2lfQ%40devstation.
For more options, visit https://groups.google.com/d/optout.
Loading...