Fix initial value for pollform is value is a "special" value (#135)
This commit is contained in:
parent
182f20308b
commit
fbc603b748
@ -28,7 +28,7 @@ class OptionForm(forms.Form, CssClassMixin):
|
|||||||
if type(vote) is Vote:
|
if type(vote) is Vote:
|
||||||
key = vote.value
|
key = vote.value
|
||||||
value = vote.get_value()
|
value = vote.get_value()
|
||||||
weight = vote.get_weight()
|
weight = vote.get_weight(raw = True)
|
||||||
else:
|
else:
|
||||||
key = vote
|
key = vote
|
||||||
value = _(vote)
|
value = _(vote)
|
||||||
|
@ -36,7 +36,9 @@ class Vote(models.Model):
|
|||||||
weight = models.IntegerField(default=1)
|
weight = models.IntegerField(default=1)
|
||||||
value = models.CharField(max_length=255, null=True)
|
value = models.CharField(max_length=255, null=True)
|
||||||
|
|
||||||
def get_weight(self):
|
def get_weight(self, raw = False):
|
||||||
|
if raw:
|
||||||
|
return self.weight
|
||||||
return print_value(self.weight)
|
return print_value(self.weight)
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user