Merge lp:~daker/loco-team-portal/fix.793557-712143 into lp:loco-team-portal

Proposed by Adnane Belmadiaf
Status: Merged
Approved by: Adnane Belmadiaf
Approved revision: 569
Merged at revision: 569
Proposed branch: lp:~daker/loco-team-portal/fix.793557-712143
Merge into: lp:loco-team-portal
Diff against target: 71 lines (+25/-9)
2 files modified
loco_directory/events/models.py (+15/-0)
loco_directory/venues/models.py (+10/-9)
To merge this branch: bzr merge lp:~daker/loco-team-portal/fix.793557-712143
Reviewer Review Type Date Requested Status
LoCo Team Portal Developers Pending
Review via email: mp+137703@code.launchpad.net

Commit message

Added event's location to the iCal
Added event's url to the iCal

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/events/models.py'
2--- loco_directory/events/models.py 2012-11-28 00:46:29 +0000
3+++ loco_directory/events/models.py 2012-12-03 22:21:20 +0000
4@@ -101,6 +101,21 @@
5 def get_absolute_url(self):
6 return ('team-event-detail', [getattr(self.first_team(), 'lp_name', 'no-team'), str(self.id), slugify(self.name)])
7
8+ def as_ical(self, cal):
9+ """
10+ return a event as ical
11+ """
12+ event = cal.add('vevent')
13+ event.add('uid').value = str(self.id)
14+ event.add('dtstart').value = pytz.utc.localize(self.date_begin)
15+ event.add('dtend').value = pytz.utc.localize(self.date_end)
16+ event.add('categories').value = ['Ubuntu Loco Team Event']
17+ event.add('summary').value = self.name or ''
18+ event.add('description').value = self.description or ''
19+ event.add('location').value = "%s" % self.venue or ''
20+ event.add('url').value = "http://loco.ubuntu.com%s" % self.get_absolute_url()
21+ event.add('geo').value = "%s;%s" % (self.venue.latitude, self.venue.longitude)
22+
23 def get_tz(self):
24 timezone = 'UTC'
25 if self.venue:
26
27=== modified file 'loco_directory/venues/models.py'
28--- loco_directory/venues/models.py 2012-06-03 18:23:49 +0000
29+++ loco_directory/venues/models.py 2012-12-03 22:21:20 +0000
30@@ -1,3 +1,4 @@
31+# -*- coding: utf-8 -*-
32 from django.db import models
33 #pylint: disable-msg=E1102
34 from django.utils.translation import ugettext_lazy as _
35@@ -32,19 +33,19 @@
36 max_length=200, verify_exists=False, blank=True, null=True)
37 comment = models.TextField(help_text=_('Comment about the Venue'), blank=True, null=True)
38
39+ objects = VenueManager()
40+
41 class Meta:
42 unique_together = (('name', 'country', 'city'), ('longitude', 'latitude'), )
43
44- #add manager
45- objects = VenueManager()
46-
47 def __unicode__(self):
48- if self.spr and self.city:
49- return '%(name)s (%(city)s, %(spr)s)' % {'name': self.name, 'city': self.city, 'spr': self.spr}
50- if self.city:
51- return '%(name)s (%(city)s)' % {'name': self.name, 'city': self.city}
52+
53+ if self.spr and self.city and self.country:
54+ return u'%s (%s, %s, %s)' % (self.name, self.city, self.spr, self.country)
55+ if self.city and self.country:
56+ return u'%s (%s, %s)' % (self.name, self.city, self.country)
57 else:
58- return self.name
59+ return u'%s' % self.name
60
61 @models.permalink
62 def get_absolute_url(self):
63@@ -54,7 +55,7 @@
64 if self.country:
65 country = self.country.slug
66 else:
67- country = 'no_country'
68+ country = u'no_country'
69 return ('venue-detail', [country, self.id])
70
71 def save(self, *args, **kargs):

Subscribers

People subscribed via source and target branches