theMobDog theMobDog - 11 months ago 38
reST (reStructuredText) Question

How to pass Regex named group variable from URL to TemplateView as argument

Say I have this URL

url(r'users/(?P<id>\d+)/edit$',TemplateView.as_view(template_name='edit.html'))


Is there a way to send the
<id>
to the template within that url pattern definition?

Answer Source

The kwargs are passed directly onto the template already. You can just to {{ id }}.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download