~ltp-devs/loco-team-portal/0.2

« back to all changes in this revision

Viewing changes to loco_directory/meetings/models.py

  • Committer: chrisjohnston at ubuntu
  • Date: 2011-02-17 07:31:59 UTC
  • mfrom: (383.5.1 712569-meeting-ical)
  • Revision ID: chrisjohnston@ubuntu.com-20110217073159-itnd39wjc4uctw11
Sets meetings to use python-vobject. Props Ronnie

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    def __unicode__(self):
23
23
        return self.name
24
24
    
25
 
    def as_ical(self):
 
25
    def as_ical(self, cal):
26
26
        """
27
27
        return a event as ical
28
28
        """
29
 
        dtstart = str(self.date_begin).replace(' ','T', 1).replace(':','',2).replace('-','',2)
30
 
        dtend = str(self.date_end).replace(' ','T', 1).replace(':','',2).replace('-','',2)
31
 
        return '''BEGIN:VEVENT
32
 
UID:%(id)s
33
 
DTSTART:%(dtstart)sZ
34
 
DTEND:%(dtend)sZ
35
 
CATEGORIES:Ubuntu Team Meeting
36
 
SUMMARY:%(meetingname)s
37
 
END:VEVENT
38
 
''' % {'id':self.id, 'dtstart':dtstart, 'dtend':dtend, 'meetingname':self.name}
 
29
        event = cal.add('vevent')
 
30
        event.add('uid').value = str(self.id)
 
31
        event.add('dtstart').value = self.date_begin
 
32
        event.add('dtend').value = self.date_end
 
33
        event.add('categories').value = ['Ubuntu Team Meeting']
 
34
        event.add('summary').value = self.name or ''
39
35
 
40
36
    def is_past(self):
41
37
        return self.date_end < datetime.datetime.today()