summaryrefslogtreecommitdiff
path: root/helsinki
diff options
context:
space:
mode:
authorJohannes Raggam <raggam-nl@adm.at>2011-04-10 19:33:58 (GMT)
committerJohannes Raggam <raggam-nl@adm.at>2011-04-10 19:33:58 (GMT)
commit7325fc951fb2ef493b9958619d7861e864be0ae3 (patch)
treeb386d80f07694b26b2cfbee95dd6461a0cfc179e /helsinki
parentbf002915e8ef950419f9cc64cb2b2946e03d8193 (diff)
templatetags introduced
Diffstat (limited to 'helsinki')
-rw-r--r--helsinki/program/templates/program/bcformats_box.html20
-rw-r--r--helsinki/program/templates/program/box_broadcastformats.html10
-rw-r--r--helsinki/program/templates/program/show_list.html13
-rw-r--r--helsinki/program/templatetags/__init__.py0
-rw-r--r--helsinki/program/templatetags/content_boxes.py15
-rw-r--r--helsinki/program/views.py8
6 files changed, 29 insertions, 37 deletions
diff --git a/helsinki/program/templates/program/bcformats_box.html b/helsinki/program/templates/program/bcformats_box.html
deleted file mode 100644
index 3067805..0000000
--- a/helsinki/program/templates/program/bcformats_box.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <meta charset="utf-8"/>
- <title>Broadcast Formats</title>
- <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" />
-</head>
-<body>
- {% if broadcastformats %}
- <dl id="bcformats" class="portlet program-bcformats">
- <dt class="portletHeader"><span>Legende<span></dt>
- {% for broadcastformat in broadcastformats %}
- <dd class="portletItem bcformat bcformat-{{ broadcastformat.slug }}">
- <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a>
- </dd>
- {% endfor %}
- </dl>
- {% endif %}
-</body>
-</html>
diff --git a/helsinki/program/templates/program/box_broadcastformats.html b/helsinki/program/templates/program/box_broadcastformats.html
new file mode 100644
index 0000000..aff4f05
--- /dev/null
+++ b/helsinki/program/templates/program/box_broadcastformats.html
@@ -0,0 +1,10 @@
+{% if broadcastformats %}
+<dl id="bcformats" class="portlet program-bcformats">
+ <dt class="portletHeader"><span>Legende<span></dt>
+ {% for broadcastformat in broadcastformats %}
+ <dd class="portletItem bcformat bcformat-{{ broadcastformat.slug }}">
+ <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a>
+ </dd>
+ {% endfor %}
+</dl>
+{% endif %}
diff --git a/helsinki/program/templates/program/show_list.html b/helsinki/program/templates/program/show_list.html
index 9539035..f938410 100644
--- a/helsinki/program/templates/program/show_list.html
+++ b/helsinki/program/templates/program/show_list.html
@@ -5,6 +5,9 @@
</head>
<body>
+{% load content_boxes %}
+{% broadcastformats %}
+
<div id="filter">
<div id="filter-title">Filter</div>
@@ -75,14 +78,6 @@
{% endfor %}
</div>
-<div id="broadcastformats">
- <div id="broadcastformats-title">Legende</div>
- {% for broadcastformat in broadcastformats %}
- <div class="{{ broadcastformat.slug }}">
- <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a>
- </div>
- {% endfor %}
-</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/helsinki/program/templatetags/__init__.py b/helsinki/program/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/helsinki/program/templatetags/__init__.py
diff --git a/helsinki/program/templatetags/content_boxes.py b/helsinki/program/templatetags/content_boxes.py
new file mode 100644
index 0000000..c43d3f3
--- /dev/null
+++ b/helsinki/program/templatetags/content_boxes.py
@@ -0,0 +1,15 @@
+# http://docs.djangoproject.com/en/dev/howto/custom-template-tags/
+
+from django import template
+register = template.Library()
+
+from helsinki.program.models import (
+ BroadcastFormat,
+ MusicFocus,
+ ShowInformation,
+ ShowTopic)
+
+@register.inclusion_tag('program/box_broadcastformats.html')
+def broadcastformats():
+ broadcastformats = BroadcastFormat.objects.all()
+ return {'broadcastformats': broadcastformats}
diff --git a/helsinki/program/views.py b/helsinki/program/views.py
index 584f24d..314de6a 100644
--- a/helsinki/program/views.py
+++ b/helsinki/program/views.py
@@ -112,11 +112,3 @@ def week_schedule(request, year, week):
return simple.direct_to_template(request, template='program/week_schedule.html', extra_context=extra_context)
-
-def bcformats(request):
- broadcastformats = BroadcastFormat.objects.all()
- extra_context = dict(broadcastformats=broadcastformats)
- return simple.direct_to_template(
- request,
- template='program/bcformats_box.html',
- extra_context=extra_context)