Thursday, April 20, 2017

Re: I can't understand this NoReverseMatch

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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.

No comments:

Post a Comment