In Django, inside a template, I do
{% url 'Customer.views.edit_customer' 1 %}
and I get a NoReverseMatch exception. However, in the line before the template render I do:
print reverse('Customer.views.edit_customer', args=(1,))
and it prints the expected URL. I know I can always just pass in the result of reverse, but I would like to understand what’s going on.
The url pattern is:
url(r'^customer/edit/(\d+)$', edit_customer),
Is there a way of doing the equivalent of the reverse call in the template?
If you are using Django 1.4, remove the quotes
see https://stackoverflow.com/a/4981105/44816
Django 1.5 will accept quoted url matching patterns. You can load the url template tag from future, if you’d like to quote your patterns. Use the following before the first url tag in your templates