From 7325fc951fb2ef493b9958619d7861e864be0ae3 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Sun, 10 Apr 2011 21:33:58 +0200 Subject: templatetags introduced 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 @@ - - - - - Broadcast Formats - - - - {% if broadcastformats %} -
-
Legende
- {% for broadcastformat in broadcastformats %} -
- {{ broadcastformat.format }} -
- {% endfor %} -
- {% endif %} - - 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 %} +
+
Legende
+ {% for broadcastformat in broadcastformats %} +
+ {{ broadcastformat.format }} +
+ {% endfor %} +
+{% 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 @@ +{% load content_boxes %} +{% broadcastformats %} +
Filter
@@ -75,14 +78,6 @@ {% endfor %}
-
-
Legende
- {% for broadcastformat in broadcastformats %} - - {% endfor %} -
- \ No newline at end of file + diff --git a/helsinki/program/templatetags/__init__.py b/helsinki/program/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 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) -- cgit v0.10.2