# HG changeset patch # User Madhusudan.C.S # Date 1296552804 -19800 # Node ID 1bfa67f465b4f533546ff698c18f8f12dad46a9f # Parent 6393b77c3c68989e8ac952956ef238b63fd5094e Define a templatetag to display list of tags and make them linked. diff -r 6393b77c3c68 -r 1bfa67f465b4 pytask/templates/task/view.html --- a/pytask/templates/task/view.html Tue Feb 01 15:02:52 2011 +0530 +++ b/pytask/templates/task/view.html Tue Feb 01 15:03:24 2011 +0530 @@ -52,13 +52,7 @@


{% if task.tags.count %} - - Tags: - {% for tag in task.tags %} - {{tag}} - {% endfor %} -
- + Tags: {% as_tags task.tags %}
{% endif %} {% if selected_users %} diff -r 6393b77c3c68 -r 1bfa67f465b4 pytask/templates/task/view_textbook.html --- a/pytask/templates/task/view_textbook.html Tue Feb 01 15:02:52 2011 +0530 +++ b/pytask/templates/task/view_textbook.html Tue Feb 01 15:03:24 2011 +0530 @@ -24,8 +24,7 @@
{% if textbook.tags.count %} - Tags: {{ textbook.tags_field }} -
+ Tags: {% as_tags textbook.tags %}
{% endif %}

diff -r 6393b77c3c68 -r 1bfa67f465b4 pytask/templates/templatetags/_as_tags.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pytask/templates/templatetags/_as_tags.html Tue Feb 01 15:03:24 2011 +0530 @@ -0,0 +1,5 @@ +
+ {% for tag in tags %} + {{ tag }}, + {% endfor %} +
\ No newline at end of file diff -r 6393b77c3c68 -r 1bfa67f465b4 pytask/templatetags/browse_helpers.py --- a/pytask/templatetags/browse_helpers.py Tue Feb 01 15:02:52 2011 +0530 +++ b/pytask/templatetags/browse_helpers.py Tue Feb 01 15:03:24 2011 +0530 @@ -47,3 +47,13 @@ return { 'message': message, } + +@register.inclusion_tag('templatetags/_as_tags.html') +def as_tags(tags): + """Returns a context dictionary containing the fields necessary + to render list of tags. + """ + + return { + 'tags': tags, + }