Compare commits
No commits in common. "b563e962dd2f905d252a1b838b75c20cde7b3375" and "6332e083c1e5c705b99faf4dfa87acc9131452aa" have entirely different histories.
b563e962dd
...
6332e083c1
|
@ -1,7 +1,7 @@
|
||||||
from datetime import date, time, datetime, timedelta
|
from datetime import date, time, datetime, timedelta
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from os import path
|
|
||||||
from icalendar import Calendar, Event, vCalAddress, vText
|
from icalendar import Calendar, Event, vCalAddress, vText
|
||||||
|
|
||||||
from colloscope.models import *
|
from colloscope.models import *
|
||||||
|
@ -10,12 +10,32 @@ LOCAL_TZ = "Europe/Paris"
|
||||||
|
|
||||||
|
|
||||||
def to_calendar(etudiant, periode):
|
def to_calendar(etudiant, periode):
|
||||||
|
cal = Calendar()
|
||||||
|
|
||||||
p = path.abspath('./static/Base_Calendar.ics')
|
cal.add("prodid", "-//Colloscope//colles.mp2i-vms.fr//")
|
||||||
|
cal.add("version", "2.0")
|
||||||
with open(p) as f:
|
cal.add(
|
||||||
cal = Calendar.from_ical(f.read())
|
"""
|
||||||
|
BEGIN:VTIMEZONE
|
||||||
|
TZID:Europe/Paris
|
||||||
|
X-LIC-LOCATION:Europe/Paris
|
||||||
|
BEGIN:DAYLIGHT
|
||||||
|
TZOFFSETFROM:+0100
|
||||||
|
TZOFFSETTO:+0200
|
||||||
|
TZNAME:CEST
|
||||||
|
DTSTART:19700329T020000
|
||||||
|
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
|
||||||
|
END:DAYLIGHT
|
||||||
|
BEGIN:STANDARD
|
||||||
|
TZOFFSETFROM:+0200
|
||||||
|
TZOFFSETTO:+0100
|
||||||
|
TZNAME:CET
|
||||||
|
DTSTART:19701025T030000
|
||||||
|
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
|
||||||
|
END:STANDARD
|
||||||
|
END:VTIMEZONE
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
rotations = Rotation.objects \
|
rotations = Rotation.objects \
|
||||||
.filter(groupes__membres=etudiant) \
|
.filter(groupes__membres=etudiant) \
|
||||||
|
@ -42,7 +62,7 @@ def to_calendar(etudiant, periode):
|
||||||
event.add("categories", "COLLE-" + str(rotation.creneau.matiere))
|
event.add("categories", "COLLE-" + str(rotation.creneau.matiere))
|
||||||
|
|
||||||
description = "Groupes: {','.join(str(groupe) for groupe in rotation.groupes.all())}"
|
description = "Groupes: {','.join(str(groupe) for groupe in rotation.groupes.all())}"
|
||||||
event.add("description", description)
|
event.add(description)
|
||||||
|
|
||||||
organizer = vCalAddress("mailto:unknown@mp2i-vms.fr")
|
organizer = vCalAddress("mailto:unknown@mp2i-vms.fr")
|
||||||
organizer.params["cn"] = vText(str(rotation.creneau.colleur))
|
organizer.params["cn"] = vText(str(rotation.creneau.colleur))
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
BEGIN:VCALENDAR
|
|
||||||
PRODID:-//mp2i-vms-[2]-(23-24)-s3//Stackity Bot Inc//EN
|
|
||||||
VERSION:2.0
|
|
||||||
CALSCALE:GREGORIAN
|
|
||||||
METHOD:PUBLISH
|
|
||||||
X-WR-CALNAME:EDT
|
|
||||||
X-WR-TIMEZONE:Europe/Paris
|
|
||||||
BEGIN:VTIMEZONE
|
|
||||||
TZID:Europe/Paris
|
|
||||||
X-LIC-LOCATION:Europe/Paris
|
|
||||||
BEGIN:DAYLIGHT
|
|
||||||
TZOFFSETFROM:+0100
|
|
||||||
TZOFFSETTO:+0200
|
|
||||||
TZNAME:CEST
|
|
||||||
DTSTART:19700329T020000
|
|
||||||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
|
|
||||||
END:DAYLIGHT
|
|
||||||
BEGIN:STANDARD
|
|
||||||
TZOFFSETFROM:+0200
|
|
||||||
TZOFFSETTO:+0100
|
|
||||||
TZNAME:CET
|
|
||||||
DTSTART:19701025T030000
|
|
||||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
|
|
||||||
END:STANDARD
|
|
||||||
END:VTIMEZONE
|
|
||||||
END:VCALENDAR
|
|
Loading…
Reference in New Issue