diff options
author | Alban Gruin | 2018-01-24 21:16:46 +0100 |
---|---|---|
committer | Alban Gruin | 2018-01-24 21:16:46 +0100 |
commit | b102f484b032f970f2b0579794ca0be42146a702 (patch) | |
tree | cb634969e81c2d4ba977e67848bce5ded41a8bd8 /feeds.py | |
parent | 88d537092fa6e7710b7c3b07c71b94d68140a5c2 (diff) | |
parent | 605eaafddc2e626dfbce13b6d1c99757562ee971 (diff) |
Merge branch 'stable/0.12.z' into prod/pa1ch/0.12.zv0.12.3-pa1chprod/pa1ch/0.12.z
Diffstat (limited to 'feeds.py')
-rw-r--r-- | feeds.py | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -21,7 +21,7 @@ from django.db.models.functions import ExtractWeek, ExtractYear from django.template import loader from django.urls import reverse from django.utils.feedgenerator import Atom1Feed, SyndicationFeed -from django.utils.timezone import localtime +from django.utils.timezone import get_current_timezone_name from icalendar import Calendar, Event @@ -40,6 +40,11 @@ class IcalFeedGenerator(SyndicationFeed): calendar = Calendar() calendar.add("prodid", "-//celcatsanitizer//NONSGML v1.0//EN") calendar.add("version", "2.0") + calendar.add("calscale", "GREGORIAN") + calendar.add("method", "PUBLISH") + calendar.add("x-wr-timezone", get_current_timezone_name()) + calendar.add("x-wr-calname", self.feed["title"]) + calendar.add("x-wr-caldesc", self.feed["title"]) self.write_events(calendar) outfile.write(calendar.to_ical()) @@ -86,12 +91,15 @@ class IcalFeed(Feed): def item_extra_kwargs(self, item): return {"uid": "{0}@celcatsanitizer".format(item.id), - "dtstart": localtime(item.begin), - "dtend": localtime(item.end), - "dtstamp": localtime(item.last_update), + "dtstart": item.begin, + "dtend": item.end, + "dtstamp": item.last_update, "summary": self.item_summary(item), "location": format_rooms(item.rooms.all())} + def title(self, obj): + return "Emploi du temps du groupe {0}".format(obj) + class IcalOnlyOneFeed(IcalFeed): def items(self, obj): |