Problem with django url template tag (and reverse () function)

I have the following view function in activity.views:

def activity_thumbnail(request, id):
  pass

I am trying to get the URL for this view in one of my templates. When I try the following:

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

I get the following error:

Rendering exception showing: Reverse for '' with arguments '(449L,)' and keyword Arguments '{}' not found.

I get the same error when trying to do the following:

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

When I try to use named parameters:

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

I get:

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

What am I doing wrong?

+3
1

activity_thumbnail urls.py

urls.py:

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

, URL-.

+4

Source: https://habr.com/ru/post/1727044/


All Articles