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
=== modified file 'loco_directory/events/models.py'
--- loco_directory/events/models.py 2011-06-30 00:23:14 +0000
+++ loco_directory/events/models.py 2011-08-27 23:22:23 +0000
@@ -133,19 +133,18 @@
133 return "%s %s %s" % (self.name, self.venue, self.date_begin or "")133 return "%s %s %s" % (self.name, self.venue, self.date_begin or "")
134134
135 def get_tz(self):135 def get_tz(self):
136 timezone = 'UTC'
136 if self.venue:137 if self.venue:
137 return self.venue.tz138 timezone = self.venue.tz
138 elif self.channel:
139 first = None
140 for t in self.teams.all():
141 if not first:
142 first = t
143 if t.tz != 'UTC':
144 return t.tz
145 return first.tz
146 else:139 else:
147 return 'UTC'140 try:
141 timezone = self.teams.exclude(tz='UTC')[0].tz
142 except IndexError:
143 # There is not team with timezone set other than the default 'UTC'
144 pass
145 return timezone
148 tz = property(get_tz)146 tz = property(get_tz)
147
149 148
150 def get_local_begin(self):149 def get_local_begin(self):
151 return self.tolocaltime(self.date_begin)150 return self.tolocaltime(self.date_begin)

Subscribers

People subscribed via source and target branches