diff options
author | Mike Crute <mcrute@gmail.com> | 2012-12-28 15:43:50 -0500 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2012-12-28 16:49:00 -0500 |
commit | dea70a8855cebe6d35eb8508ee150a79e87b8f45 (patch) | |
tree | 3b4d257afa155a341ba4df643718ab56dbe9a411 /proposals/templatetags/icons.py | |
parent | 58bb872b14658fac9ad719f46bb4b1f80c966fc1 (diff) | |
download | django-precompiler-dea70a8855cebe6d35eb8508ee150a79e87b8f45.tar.bz2 django-precompiler-dea70a8855cebe6d35eb8508ee150a79e87b8f45.tar.xz django-precompiler-dea70a8855cebe6d35eb8508ee150a79e87b8f45.zip |
Users can submit talk proposals
Diffstat (limited to 'proposals/templatetags/icons.py')
-rw-r--r-- | proposals/templatetags/icons.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/proposals/templatetags/icons.py b/proposals/templatetags/icons.py new file mode 100644 index 0000000..551ad49 --- /dev/null +++ b/proposals/templatetags/icons.py | |||
@@ -0,0 +1,14 @@ | |||
1 | from django import template | ||
2 | from django.utils.html import format_html | ||
3 | from django.contrib.admin.templatetags.admin_static import static | ||
4 | |||
5 | |||
6 | register = template.Library() | ||
7 | |||
8 | |||
9 | @register.filter | ||
10 | def boolean_icon(value): | ||
11 | icon_url = static('admin/img/icon-%s.gif' % | ||
12 | {True: 'yes', False: 'no', None: 'unknown'}[value]) | ||
13 | alt_text = {True: 'yes', False: 'no', None: 'pending' }[value] | ||
14 | return format_html('<img src="{0}" alt="{1}" />', icon_url, alt_text) | ||