aboutsummaryrefslogtreecommitdiffstats
path: root/archive/templatetags
diff options
context:
space:
mode:
Diffstat (limited to 'archive/templatetags')
-rw-r--r--archive/templatetags/__init__.py0
-rw-r--r--archive/templatetags/archive_utils.py32
2 files changed, 32 insertions, 0 deletions
diff --git a/archive/templatetags/__init__.py b/archive/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/archive/templatetags/__init__.py
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
+