I'm trying to use the url template tag as such:
{% url all-labs-map %}
but when i view the page, i get this error:
Caught NoReverseMatch while rendering: Reverse for 'all-labs-map' with arguments '()' and keyword arguments '{}' not found.
When I use the template tag like this:
{% url gmaps.views.all_labs %}
It works just fine.
Here's the URL conf:
urlpatterns = patterns('gmaps.views',
url(r'^lab_list/$', 'all_labs', name="all-labs-map" ),
)
I tried using the django shell to see if there was a problem with the named URL, but using
reverse('all-labs-map')
returns the correct URL.
Any ideas on what's going on?
Thanks!
Majd
EDIT:
I am using django 1.2 on ubuntu with nginx server and gunicorn and virtualenv. I'm having another trouble with a custom tag where the library loads, but the tag itself is not recognized even though i'm using the correct tag registration syntax. Any ideas would be very greatly appreciated!
This is still high in Google results, but no one has answered it correctly yet. The key is this:
{% load url from future %}
Prior to Django 1.3, this was the syntax for the url
templatetag:
{% url view_name arg1 %}
In Django 1.5, this will be the syntax:
{% url "view_name" arg1 %}
Starting in Django 1.3, the old version works but gives you a deprecation warning, telling you to {% load url from future %}
and switch to the new version of that templatetag, in preparation for Django 1.5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With