Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3 from rmorell/master

A few more...
  • Loading branch information...
commit 2bf4573885df9c15b1eac8f43963dda5119cfa06 2 parents 0ff4bd6 + 960ad87
Brian Klug dustball authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 models.py
6 models.py
View
@@ -40,6 +40,8 @@ def vote_for_member(self,member=None):
return self.votes.filter('member =',member).get()
def register_vote(self,choice,member=None):
+ if self.has_results:
+ raise Exception('Cannot vote in closed polls.')
if not member:
member = users.get_current_user()
member_vote = self.vote_for_member(member)
@@ -59,6 +61,8 @@ def register_vote(self,choice,member=None):
def extend_duration(self,hours):
if hours <= 0:
raise Exception('Negative extensions are not valid.')
+ if self.has_results:
+ raise Exception('Cannot extend closed polls.')
self.duration += hours
if self.start_time:
self.end_time = self.start_time + timedelta(hours=self.duration)
@@ -76,9 +80,11 @@ def hours_left(self):
return hours
def is_active(self):
+ self.update_status()
return self.status in ('active')
def has_results(self):
+ self.update_status()
return self.status in ('done')
def member_is_creator(self,member=None):
Please sign in to comment.
Something went wrong with that request. Please try again.