I tried to add named url of django into jinja template, the code is
below:
utils.py
====
from django.contrib.jinja import register
def myurl(view_name, *args, **kwargs):
from django.core.urlresolvers import reverse
return reverse(view_name, args=args, kwargs=kwargs)
register.object(myurl, 'url_for')
hello.html
======
<a href="{{ url_for('greet', username) }}">link to a user</a>
urls.py
====
url(r'^hello/(?P<username>\w+)/$', views.hello, name='greet'),
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---