pytask/templatetags/browse_helpers.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Thu, 20 Jan 2011 17:42:46 +0530
changeset 498 9f04b7bcc333
parent 496 eb1982186306
child 505 a05fde6309e1
permissions -rw-r--r--
Add a new templatetag to render modified on and by line in documents. Add the necessary div tags, html templates, templatetag function and the CSS to give necessary layout and styling.

"""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_modification_display.html')
def as_modification_display(title, user, creation_datatime):
    """Returns a context dictionary containing the fields necessary
    to render the creation/modification
    """

    return {
      'title': title,
      'user': user,
      'modification_datetime': creation_datatime,
      }