On Mon, Aug 15, 2011 at 8:37 PM, Thomas Weholt <[email protected]> wrote:
> My urls.py for my app:
>
> urlpatterns = patterns('',
> url(r'^geocoding/$', geocoding, name='geocoding'),
> )
>
> I've extended the change_list.html template based on the standard
> change_list.html and added this piece :
>
> {% block content %}
> <div id="content-main">
> {% block object-tools %}
> {% if has_add_permission %}
> <ul class="object-tools">
> <li>
> <a href="{% url geocoding %}" class="addlink">From geocoding</a>
> </li>
>
> where {% url geocoding %} is the problem. When rendered it says:
>
> TemplateSyntaxError at /admin/locationbase/location/
> Caught NoReverseMatch while rendering: Reverse for '' with arguments
> '()' and keyword arguments '{}' not found.
>
> So the question is; how can I use the url template tag in templates
> extending the standard admin templates and refer to a view defined in
> my app by name?
>
> What am I now seeing here?
>
So, you don't state your django version.
I think either your template, or perhaps some combination of your
template and the admin templates, is loading the future version of the
url tag. The future version does not interpret a constant as the view
name, but as a context variable which it then resolves. I guess
'geocoding' doesn't correspond to a context variable, and hence the
error message.
Does it work if you quote the view name? Eg:
{% url "geocoding" %}
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.