Friday, April 28, 2017

NoReverseMatch

Hey all,

Can anyone tell me the (probably quite obvious) reason my reverse match isn't working?

Template:
<form method="post" action="{% url 'cal:delete_event' id %}">
  <input class="btn btn-primary btn-md" id="event-delete" type="submit" value="Delete">
</form>

Url:
url(r'^events/(\d+)/delete_event$', views.delete_event, name='delete_event'),

View:
def delete_event(request, id):
    Events.objects.filter(id=id).delete()
    return redirect("cal:home")

Also, if anyone can tell me a good way to get my delete button I'd be very grateful. 

Cheers,

Will

--
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/d4dfea2a-2e59-4665-9a52-67af52e6476c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment