Commit 1399eed3 authored by Julian Rother's avatar Julian Rother
Browse files

Reformatted ical events

parent 211e2dee
......@@ -9,19 +9,22 @@ def export_lectures(lectures, name):
cal.add('version', '1.0')
for l in lectures:
event = icalendar.Event()
event.add('summary', l['course']['short']+' : '+l['title'])
event.add('description', l['internal'])
event.add('uid', 'lecture_'+str(l['id'])+'')
event.add('comment', l['comment'])
event.add('summary', l['course']['short']+': '+l['title'])
event.add('description', '\n\n'.join([s for s in [
'Zuständig: '+l['course']['responsible'] if l['course']['responsible'] else ''
] if s]))
event.add('uid', ''%l['id'])
event.add('dtstamp', datetime.utcnow())
event.add('categories', l['course']['short'])
event.add('dtstart', l['time'])
event.add('location', l['place'])
event.add('dtend', l['time'] + timedelta(minutes=l['duration']))
H = Headers()
H.add_header("Content-Disposition", "inline", filename=name)
return Response(cal.to_ical(), mimetype="text/calendar", headers=H)
h = Headers()
h.add_header("Content-Disposition", "inline", filename=name)
return Response(cal.to_ical(), mimetype="text/calendar", headers=h)
def calperm(func):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment