#288 fix type error if a poll has no votecast

This commit is contained in:
Oskar Hahn 2012-07-14 08:48:25 +02:00
parent e4250b6ba1
commit a1152af7ea

View File

@ -82,7 +82,10 @@ class CountVotesCast(models.Model):
return print_value(self.votescast) return print_value(self.votescast)
def percent_base(self): def percent_base(self):
return 100 / float(self.votescast) try:
return 100 / float(self.votescast)
except TypeError:
return 0
class Meta: class Meta:
abstract = True abstract = True