aboutsummaryrefslogtreecommitdiffstats
path: root/archive/templatetags/archive_utils.py
blob: 1f44fd1fa6ab371f8d08bfc6784c11e0f30338ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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