diff options
author | Madhusudan.C.S | 2011-01-20 07:55:38 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2011-01-20 07:55:38 +0530 |
commit | ae1ee0967d189ca3a37438bd88d3baec6ed279f5 (patch) | |
tree | b84688af112a99f163936998f601542cefc1a7a3 | |
parent | af9eadb2c0546bf7a566f81503f977f74b2a845f (diff) | |
download | pytask-ae1ee0967d189ca3a37438bd88d3baec6ed279f5.tar.gz pytask-ae1ee0967d189ca3a37438bd88d3baec6ed279f5.tar.bz2 pytask-ae1ee0967d189ca3a37438bd88d3baec6ed279f5.zip |
Add templatetags for listing textbooks.
This templatetag must be refactored to be utilized for tasks also.
-rw-r--r-- | pytask/templates/templatetags/_as_browse_textbooks.html | 12 | ||||
-rw-r--r-- | pytask/templatetags/browse_helpers.py | 35 |
2 files changed, 47 insertions, 0 deletions
diff --git a/pytask/templates/templatetags/_as_browse_textbooks.html b/pytask/templates/templatetags/_as_browse_textbooks.html new file mode 100644 index 0000000..56a1a21 --- /dev/null +++ b/pytask/templates/templatetags/_as_browse_textbooks.html @@ -0,0 +1,12 @@ +<h2>{{ title }}</h2> +<h3>List of textbooks open for contribution</h3> +<ul> + {% for task in tasks %} + <li> + <a href="{% url view_textbook task.id %}"> + {{ task.title }} + </a> + </li> + {% endfor %} +</ul> +<br /> diff --git a/pytask/templatetags/browse_helpers.py b/pytask/templatetags/browse_helpers.py new file mode 100644 index 0000000..1148118 --- /dev/null +++ b/pytask/templatetags/browse_helpers.py @@ -0,0 +1,35 @@ +"""Module containing the templatetags for rendering data especially for +browsing. +""" + + +__authors__ = [ + '"Madhusudan.C.S" <madhusudancs@fossee.in>', + ] + + +from django import template + + +register = template.Library() + + +@register.inclusion_tag('templatetags/_as_browse_textbooks.html') +def as_list_textbooks(textbooks, title): + """Returns a dictionary required to display the list of tasks. + """ + + return { + 'tasks': textbooks, + 'title': title, + } + + +@register.inclusion_tag('templatetags/_as_div_field.html') +def as_div_field(field): + """Returns the field for each div form field. + """ + + return { + 'field': field, + } |