From ed3d74e61300f91818eeff9dad7e9d35c556f75a Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Tue, 24 Jun 2014 16:39:42 +0800 Subject: Added app schedule, tools and archive/templatetags; updated settings. * Added app 'schedule' to provides a more generic schedule page * Added fake app 'tools' to holds generic utilities * Moved notice/templatetags to tools/templatetags * Small change to archive.models.Archive display format * Added archive/templatetags * Small update to introduction page --- archive/templatetags/__init__.py | 0 archive/templatetags/archive_utils.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 archive/templatetags/__init__.py create mode 100644 archive/templatetags/archive_utils.py (limited to 'archive/templatetags') diff --git a/archive/templatetags/__init__.py b/archive/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/archive/templatetags/archive_utils.py b/archive/templatetags/archive_utils.py new file mode 100644 index 0000000..1f44fd1 --- /dev/null +++ b/archive/templatetags/archive_utils.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# utilities to use with app 'archive' +# + +from django import template + +from archive.models import Archive + + +register = template.Library() + +@register.filter +def get_archive_title(id): + archive = Archive.objects.get(id=id) + return archive.title + +@register.filter +def get_archive_description(id): + archive = Archive.objects.get(id=id) + return archive.description + +@register.filter +def get_archive_url(id): + archive = Archive.objects.get(id=id) + return archive.file.url + +@register.filter +def get_archive_category(id): + archive = Archive.objects.get(id=id) + return archive.category.name + -- cgit v1.2.2