On Wed, Jan 18, 2012 at 3:46 PM, Mark Stahler <markstah...@gmail.com> wrote:
> Can someone explain how to link using url names to class-based views
> that include parameters?
>
> Example:
>
> url(r'^video/(?P<pk>\d+)/$', VideoView.as_view()),
>
> works but all my links have to manually have "/video/{{ video.id }}/"
> or similar. I cannot get {% url videos %}{{ video.id }} to work with
> the following route for some reason.
>
> url(r'^video/(?P<pk>\d+)/$', VideoView.as_view(), name='videos'),
>
> I cant find anything in the documentation about this. Can anyone
> explain?
>

Your URL takes a parameter, but you are not giving it one. Try:

  {% url videos video.id %}

See:

https://docs.djangoproject.com/en/1.3/topics/http/urls/#reverse

and:

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url

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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to