Friday, April 28, 2017

Re: NoReverseMatch



On Apr 28, 2017 4:32 PM, "shahab emami" <royaramezan@gmail.com> wrote:
hi
this is for the id.
your url must be like this:

url(r'^events/((?P<id>\d+))/delete/$', views.delete_event, name='delete_event'),



you also need to give an amount in your template to the id:




action="{% url 'cal:delete_event' id=an_event_id %}">



Or, the variable 'id' either doesn't exist or isn't populated, also causing the URL look-up to fail, based on the traceback you provided.



django.urls.exceptions.NoReverseMatch: Reverse for 'delete_event' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: ['cal/events/(\\d+)/delete_event$']

The traceback in this case is a bit misleading because of the missing named group in the regex. 

You'll need to fix both issues before the resolution will succeed.

-James

--
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/CA%2Be%2BciXmK65EKt2mBhYQ6M7sEuM9zcFJkLLYq5e9oD%2BXtm%2BdGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment