Reputation: 1526
I am trying to use the reverse
function in django with no luck. I already tried to change the args and use all combinations of long, int, string, unicode-string, etc, with the same error.
Help, please? Thanks.
Error I am getting:
Exception Type: NoReverseMatch at /ajax/data-request
Exception Value: Reverse for 'views.watch' with arguments '(1, 1, 'aaa')' and keyword arguments '{}' not found. 0 pattern(s) tried: []
urls.py:
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', views.index, name='index'),
url(r'^options/', views.options, name='options'),
url(r'^recuperar-contrasena/', views.recover_password, name='recover_password'),
url(r'^ajax/login', views.login_ajax, name='login_ajax'),
url(r'^ajax/data-request', views.data_request, name='data_request'),
url(r'^peliculas-populares', views.movies_popular, name='movies_popular'),
url(r'^peliculas-todas', views.movies_all, name='movies_all'),
url(r'^watch/(?P<is_movie>\d+)-(?P<id>\d+)/(?P<name>.*)$', views.watch, name='watch')
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Reverse function:
'watch-url': reverse('views.watch', None, [(is_movie), (movie.id), (slugify(movie.title))])
{% url %}
that works in my template:
{% url "watch" 1 movie.id movie.title|slugify %}
Upvotes: 1
Views: 191
Reputation: 473763
The reverse()
call is incorrect, should be:
reverse('watch', None, [(is_movie), (movie.id), (slugify(movie.title))]
Upvotes: 1