Merge lp:~ronnie.vd.c/loco-team-portal/team-event-timezome into lp:loco-team-portal

Proposed by Ronnie
Status: Merged
Approved by: Chris Johnston
Approved revision: 475
Merged at revision: 477
Proposed branch: lp:~ronnie.vd.c/loco-team-portal/team-event-timezome
Merge into: lp:loco-team-portal
Diff against target: 32 lines (+9/-10)
1 file modified
loco_directory/events/models.py (+9/-10)
To merge this branch: bzr merge lp:~ronnie.vd.c/loco-team-portal/team-event-timezome
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+73152@code.launchpad.net

Commit message

Fixed displaying of event timezome when event has no venue or channel

Description of the change

Fixed displaying of event timezome when event has no venue or channel

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) wrote :

Looks good

review: Approve

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 2011-06-30 00:23:14 +0000
3+++ loco_directory/events/models.py 2011-08-27 23:22:23 +0000
4@@ -133,19 +133,18 @@
5 return "%s %s %s" % (self.name, self.venue, self.date_begin or "")
6
7 def get_tz(self):
8+ timezone = 'UTC'
9 if self.venue:
10- return self.venue.tz
11- elif self.channel:
12- first = None
13- for t in self.teams.all():
14- if not first:
15- first = t
16- if t.tz != 'UTC':
17- return t.tz
18- return first.tz
19+ timezone = self.venue.tz
20 else:
21- return 'UTC'
22+ try:
23+ timezone = self.teams.exclude(tz='UTC')[0].tz
24+ except IndexError:
25+ # There is not team with timezone set other than the default 'UTC'
26+ pass
27+ return timezone
28 tz = property(get_tz)
29+
30
31 def get_local_begin(self):
32 return self.tolocaltime(self.date_begin)

Subscribers

People subscribed via source and target branches