views:

229

answers:

1

I have the following view function in activities.views:

def activity_thumbnail(request, id):
  pass

I'm trying to get the URL for that view in one of my templates. When I try the following:

{% url activities.views.activity_thumbnail latest_activity.id %}

I get the following error:

Caught an exception while rendering: Reverse for '' with arguments '(449L,)' and keyword arguments '{}' not found.

I get the same kind of error when I try the following:

{% url activities.views.activity_thumbnail request,latest_activity.id %}

When I try named parameters:

{% url activities.views.activity_thumbnail id=r.latest_activity.key.id %}

I get:

Caught an exception while rendering: Reverse for '' with arguments '()' and keyword arguments '{'id': 449L}' not found.

What am I doing wrong?

+2  A: 

You didn't define activity_thumbnail in your urls.py

urls.py:

from views import activity_thumbnail
urlpatterns = patterns('',
    url('^activity_thumbnail/$', activity_thumbnail, name='activity_thumbnail')
)

That might seem a bit redundant, but it gives you more freedom in mapping your views into urls.

Antony Hatchkins