type in last commit, template update, form update
info in template, that -1 is majority and -2 in undocumentet update option_form. -2 is a valide value
This commit is contained in:
parent
7be90c89c7
commit
7fc12e51f9
@ -7,6 +7,7 @@
|
||||
{% blocktrans count counter=options|length %}candidate{% plural %}candidates{% endblocktrans %}
|
||||
</p>
|
||||
<p><b>{% trans "Short description" %}:</b> {{ poll.description }}</p>
|
||||
<i>-1 := {% trans 'majority' %}, -2 := {% trans 'undocumented' %}</i>
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
<table class="table" style="width:auto;">
|
||||
<tr>
|
||||
|
@ -42,6 +42,6 @@ class OptionResultForm(Form):
|
||||
error_css_class = 'error'
|
||||
required_css_class = 'required'
|
||||
|
||||
yes = IntegerField(min_value=-1, widget=TextInput(attrs={'class': 'small-input'}), label=_("Yes"))
|
||||
no = IntegerField(min_value=-1, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("No"))
|
||||
undesided = IntegerField(min_value=-1, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("Abstention"))
|
||||
yes = IntegerField(min_value=-2, widget=TextInput(attrs={'class': 'small-input'}), label=_("Yes"))
|
||||
no = IntegerField(min_value=-2, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("No"))
|
||||
undesided = IntegerField(min_value=-2, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("Abstention"))
|
||||
|
@ -125,7 +125,7 @@ class Option(models.Model):
|
||||
def yes(self):
|
||||
if self.voteyes == -1:
|
||||
return _('majority')
|
||||
if self.voteno == -2:
|
||||
if self.voteyes == -2:
|
||||
return _('undocumented')
|
||||
if self.voteyes:
|
||||
return self.voteyes
|
||||
@ -145,7 +145,7 @@ class Option(models.Model):
|
||||
def undesided(self):
|
||||
if self.voteundesided == -1:
|
||||
return _('majority')
|
||||
if self.voteno == -2:
|
||||
if self.voteundesided == -2:
|
||||
return _('undocumented')
|
||||
if self.voteundesided:
|
||||
return self.voteundesided
|
||||
@ -163,5 +163,5 @@ class Option(models.Model):
|
||||
|
||||
def __unicode__(self):
|
||||
if self.value:
|
||||
return self.value
|
||||
return unicode(self.value)
|
||||
return _("No options")
|
||||
|
Loading…
Reference in New Issue
Block a user