Download of event list: added new template for ka-alpin layout. formated

all dates appropriate.
This commit is contained in:
2018-03-06 22:57:15 +01:00
parent d8939afcac
commit 13160bce7e
5 changed files with 60 additions and 9 deletions

View File

@@ -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())