1

On my template I have this

<a href="{% url 'call_donation' event=event.id %}" class="button" >Pitch in</a>

on views.py

def callDonation(request, event_id):
    donation = DonationOrder.create(event_id)
    storecod = Store.getStoreCode()
    url = "https://www.externallink.com/pay/payment.asp?codtienda=%s&numcompra=%s&mount=" % (storecod, donation.order_id)
    return HttpResponseRedirect(url)

on urls.py

url(r'^events/(\d+)/$', views.callDonation, name="call_donation")

But getting

Reverse for 'call_donation' with arguments '()' and keyword arguments '{u'event': 4L}' not found. 1 pattern(s) tried: ['events/(\\d+)/$']

I'm lost on what should I change to make it work

1 Answer 1

3

You have to specify keyword name in urlpatterns, like this:

url(r'^events/(?P<event_id>\d+)/$', views.callDonation, name="call_donation")

Also you have to make sure, that you pass correct keyword name in template (e.g. event_id instead of event).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.