aboutsummaryrefslogtreecommitdiff
path: root/feeds.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-07 18:04:31 +0100
committerAlban Gruin2017-11-07 18:04:31 +0100
commitffffd9842dbaba0b0e89ff5f434f45792e2b73b6 (patch)
tree8e771d2e87e3fcc28efd1bd3beb4583af8231f88 /feeds.py
parentae3358c1296a02352409910a9ffcc2307d5ea87a (diff)
parent04ca9906dccbfd290a08aef037873302ff7eac3d (diff)
Merge branch 'stable/0.11.z' into prod/pa1ch/0.y.zv0.11.0-pa1ch
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()