Skip to content
Snippets Groups Projects
Commit 1399eed3 authored by Julian Rother's avatar Julian Rother
Browse files

Reformatted ical events

parent 211e2dee
No related branches found
No related tags found
No related merge requests found
......@@ -10,18 +10,21 @@ def export_lectures(lectures, name):
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'])+'@rwth.video')
event.add('comment', l['comment'])
event.add('description', '\n\n'.join([s for s in [
l['comment'],
l['internal'],
'Zuständig: '+l['course']['responsible'] if l['course']['responsible'] else ''
] if s]))
event.add('uid', '%i@rwth.video'%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']))
cal.add_component(event)
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):
@wraps(func)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment