Your Ad Here

Wednesday, January 18, 2012

url name to generic class-based views with parameters?

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?

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

0 comments:

Post a Comment