aboutsummaryrefslogtreecommitdiff
path: root/feeds.py
diff options
context:
space:
mode:
Diffstat (limited to 'feeds.py')
-rw-r--r--feeds.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/feeds.py b/feeds.py
index e97c29a..72d7873 100644
--- a/feeds.py
+++ b/feeds.py
@@ -23,11 +23,7 @@ from icalendar import Calendar, Event
from .models import Course, Group, Timetable
from .templatetags.rooms import format_rooms
-ICAL_NAMES = {"name": "summary",
- "notes": "description",
- "rooms": "location",
- "begin": "dtstart",
- "end": "dtend"}
+ICAL_NAMES = ["summary", "description", "location", "start", "dtstart", "dtend"]
class IcalFeedGenerator(SyndicationFeed):
@@ -43,9 +39,9 @@ class IcalFeedGenerator(SyndicationFeed):
def write_events(self, calendar):
for item in self.items:
event = Event()
- for key, value in ICAL_NAMES.items():
+ for key in ICAL_NAMES:
if item.get(key) is not None:
- event.add(value, item[key])
+ event.add(key, item[key])
calendar.add_component(event)
@@ -62,6 +58,9 @@ class IcalFeed(Feed):
else:
return group
+ def item_description(self, item):
+ return item.notes
+
def item_link(self, item):
return ""
@@ -69,8 +68,7 @@ class IcalFeed(Feed):
return Course.objects.get_courses_for_group(obj).order_by("begin")
def item_extra_kwargs(self, item):
- return {"begin": item.begin,
- "end": item.end,
- "name": item.name,
- "notes": item.notes,
- "rooms": format_rooms(item.rooms.all())}
+ return {"dtstart": item.begin,
+ "dtend": item.end,
+ "summary": item.name,
+ "location": format_rooms(item.rooms.all())}