aboutsummaryrefslogtreecommitdiff
path: root/feeds.py
diff options
context:
space:
mode:
Diffstat (limited to 'feeds.py')
-rw-r--r--feeds.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/feeds.py b/feeds.py
index 564b285..aced5e6 100644
--- a/feeds.py
+++ b/feeds.py
@@ -29,7 +29,7 @@ from .templatetags.rooms import format_rooms
from .utils import get_current_or_next_week, get_week, group_courses
ICAL_NAMES = ["uid", "summary", "description", "location",
- "start", "dtstart", "dtend", "dtstamp"]
+ "start", "dtstart", "dtend", "dtstamp", "categories"]
class IcalFeedGenerator(SyndicationFeed):
@@ -66,12 +66,20 @@ class IcalFeed(Feed):
else:
return group
+ def item_categories(self, item):
+ return (item.type,)
+
def item_description(self, item):
return item.notes
def item_link(self, item):
return ""
+ def item_summary(self, item):
+ if item.type is not None:
+ return item.name + " (" + item.type + ")"
+ return item.name
+
def items(self, obj):
return Course.objects.get_courses_for_group(obj)
@@ -80,10 +88,15 @@ class IcalFeed(Feed):
"dtstart": item.begin,
"dtend": item.end,
"dtstamp": item.last_update,
- "summary": item.name + " (" + item.type + ")",
+ "summary": self.item_summary(item),
"location": format_rooms(item.rooms.all())}
+class IcalOnlyOneFeed(IcalFeed):
+ def items(self, obj):
+ return Course.objects.filter(groups=obj).order_by("begin")
+
+
class RSSFeed(Feed):
def get_object(self, request, year_slug, timetable_slug, group_slug):
year, week = get_current_or_next_week()