Generated: Sat 2013-02-23 20:08 SGT
Source file: /Users/martin/Repos/django-document-library/document_library/templatetags/document_library_tags.py
Stats: 9 executed, 0 missed, 3 excluded, 14 ignored
"""Templatetags for the ``document_library`` app."""from django import templatefrom simple_translation.middleware import filter_queryset_languagefrom document_library.models import Document, DocumentTitleregister = template.Library()@register.assignment_tagdef get_files_for_document(document): """Returns all available files for the given document.""" titles = DocumentTitle.objects.filter( document=document, filer_file__isnull=False) files = [title.filer_file for title in titles] return files@register.assignment_tag(takes_context=True)def get_frontpage_documents(context): """Returns the library favs that should be shown on the front page.""" req = context.get('request') qs = Document.objects.published(req).filter(is_on_front_page=True) return qs