Download of event list: added new template for ka-alpin layout. formated
all dates appropriate.
This commit is contained in:
@@ -529,16 +529,17 @@ class Event(models.Model):
|
||||
return r
|
||||
|
||||
def render_as_text(self, format=None):
|
||||
template_name = os.path.join('dav_events', 'event.txt')
|
||||
template = get_template(template_name)
|
||||
context = {}
|
||||
if format == 'kaalpin':
|
||||
context['normalized_date'] = self.get_formated_date(format='normalized_short')
|
||||
context['alt_normalized_date'] = self.get_alt_formated_date(format='normalized_short')
|
||||
return template.render(self.get_template_context(context))
|
||||
if format == 'ka-alpin':
|
||||
template_name = 'ka-alpin.txt'
|
||||
else:
|
||||
template_name = 'default.txt'
|
||||
|
||||
template_path = os.path.join('dav_events', 'event', template_name)
|
||||
template = get_template(template_path)
|
||||
return template.render(self.get_template_context())
|
||||
|
||||
def render_as_html(self):
|
||||
template_name = os.path.join('dav_events', 'event.html')
|
||||
template_name = os.path.join('dav_events', 'event', 'default.html')
|
||||
template = get_template(template_name)
|
||||
return template.render(self.get_template_context())
|
||||
|
||||
|
||||
50
dav_events/templates/dav_events/event/ka-alpin.txt
Normal file
50
dav_events/templates/dav_events/event/ka-alpin.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
{% load i18n %}{{ number }} - {{ title }}
|
||||
|
||||
{{ normalized_short_date }}
|
||||
{% if alt_normalized_short_date %}({% trans 'Ersatztermin' %}: {{ alt_normalized_short_date }})
|
||||
{% endif %}
|
||||
{{ description }}
|
||||
{% if mode == 'training' %}
|
||||
{% trans 'Kursinhalte' %}:
|
||||
{% if course_topic_2 %}
|
||||
- {{ course_topic_1 }}
|
||||
- {{ course_topic_2 }}
|
||||
{% if course_topic_3 %} - {{ course_topic_3 }}
|
||||
{% endif %}{% if course_topic_4 %} - {{ course_topic_4 }}
|
||||
{% endif %}{% if course_topic_5 %} - {{ course_topic_5 }}
|
||||
{% endif %}{% if course_topic_6 %} - {{ course_topic_6 }}
|
||||
{% endif %}{% else %}
|
||||
{{ course_topic_1 }}
|
||||
{% endif %}
|
||||
{% trans 'Kursziele' %}:
|
||||
{% if course_goal_2 %}
|
||||
- {{ course_goal_1 }}
|
||||
- {{ course_goal_2 }}
|
||||
{% if course_goal_3 %} - {{ course_goal_3 }}
|
||||
{% endif %}{% if course_goal_4 %} - {{ course_goal_4 }}
|
||||
{% endif %}{% if course_goal_5 %} - {{ course_goal_5 }}
|
||||
{% endif %}{% if course_goal_6 %} - {{ course_goal_6 }}
|
||||
{% endif %}{% else %}
|
||||
{{ course_goal_1 }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if requirements %}{% trans 'Anforderungen' %}: {{ requirements }}
|
||||
{% endif %}{% if equipment %}{% trans 'Ausrüstung' %}: {{ equipment }}
|
||||
{% endif %}{% if location %}{% trans 'Ort' %}: {{ location }} {% if country and country != 'DE' and country != 'XX' %}({{ country }}){% endif %}
|
||||
{% endif %}{% if basecamp %}{% trans 'Stützpunkt' %}: {{ basecamp }}
|
||||
{% endif %}{% if accommodation and accommodation != 'NONE' %}{% trans 'Unterkunft' %}: {% if accommodation == 'OTHER' %}{{ accommodation_other }}{% else %}{{ event.get_accommodation_display }}{% endif %}
|
||||
{% endif %}{% if meals and meals != 'NONE' %}{% trans 'Verpflegung' %}: {% if meals == 'OTHER' %}{{ meals_other }}{% else %}{{ event.get_meals_display }}{% endif %}
|
||||
{% endif %}{% if transport and transport != 'NONE' and transport != 'public' %}{% trans 'Hin- / Rückfahrt' %}: {% if transport == 'OTHER' %}{{ transport_other }}{% else %}{{ event.get_transport_display }}{% endif %}
|
||||
{% endif %}{% if meeting_point and meeting_point != 'NONE' %}{% trans 'Treffpunkt' %}: {% if meeting_time %}{{ meeting_time|time:'G:i'|cut:':00' }} Uhr, {% endif %}{% if meeting_point == 'OTHER' %}{{ meeting_point_other }}{% else %}{{ event.get_meeting_point_display }}{% endif %}
|
||||
{% endif %}{% if transport == 'public' %}{% if departure_time or departure_ride %}{% trans 'Abfahrt' %}: {% if departure_time %}{{ departure_time|time:'G:i'|cut:':00' }} Uhr{% endif %}{% if departure_time and departure_ride %}, {% endif %}{% if departure_ride %}{{ departure_ride }}{% endif %}
|
||||
{% endif %}{% endif %}{% if return_departure_time or return_arrival_time %}{% trans 'Rückfahrt' %}: {% if return_arrival_time %}{{ return_arrival_time|time:'G:i'|cut:':00' }} Uhr ({% trans 'Ankunft in' %} Karlsruhe){% elif return_departure_time %}{{ return_departure_time|time:'G:i'|cut:':00' }} Uhr ({% trans 'Abfahrt am Tourenort' %}){% endif %}
|
||||
{% endif %}{% if pre_meeting_1 %}{% if pre_meeting_2 %}{% trans 'Vortreffen' %} 1: {{ pre_meeting_1|date:'D, j. N Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}
|
||||
{% trans 'Vortreffen' %} 2: {{ pre_meeting_2|date:'D, j. N Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}{% else %}{% trans 'Vortreffen' %}: {{ pre_meeting_1|date:'D, j. N Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}{% endif %}
|
||||
{% endif %}{% if min_participants > 0 or max_participants > 0 %}{% trans 'Teilnehmerzahl' %}: {% if min_participants == max_participants %}{{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 and max_participants > 0 %}{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 %}min. {{ min_participants }} {% trans 'Teilnehmer' %}{% else %}max. {{ max_participants }} {% trans 'Teilnehmer' %}{% endif %}
|
||||
{% endif %}{% if charge > 0 or additional_costs %}{% trans 'Kosten' %}: {% if charge > 0 %}{{ charge|floatformat:'-2' }} € {% trans 'Teilnahmegebühr' %}{% endif %}{% if additional_costs %}{% if charge > 0 %} {% trans 'zzgl.' %} {% endif %}{{ additional_costs }}{% endif %}
|
||||
{% endif %}{% if registration_required and deadline %}{% trans 'Anmeldeschluss' %}: {{ deadline|date:'D, j. N Y' }}
|
||||
{% endif %}{% if trainer_2_fullname %}{% if mode == 'training' %}{% trans 'Ausbildungsteam' %}:{% else %}{% trans 'Team' %}:{% endif %} {{ trainer_firstname }} {{ trainer_familyname }}, {{ trainer_2_fullname }}{% if trainer_3_fullname %}, {{ trainer_3_fullname }}{% endif %}
|
||||
{% endif %}{% if trainer_familyname %}{% trans 'Leitung' %}: {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}{{ trainer_email }}{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}){% endif %}
|
||||
{% endif %}{% if registration_required and registration_howto %}
|
||||
{{ registration_howto }}
|
||||
{% endif %}
|
||||
@@ -90,7 +90,7 @@ class EventListExportView(generic.FormView):
|
||||
for event in event_qs:
|
||||
if exclude_expired and event.get_status() == 'expired':
|
||||
continue
|
||||
txt += event.render_as_text(format='kaalpin')
|
||||
txt += event.render_as_text(format='ka-alpin')
|
||||
if event.internal_note:
|
||||
txt += u'\n> Bearbeitungshinweis:\n> ' + event.internal_note.replace('\n', '\n> ') + u'\n'
|
||||
txt += u'\n' + (u'-' * 72) + '\n\n'
|
||||
|
||||
Reference in New Issue
Block a user