diff --git a/CHANGELOG b/CHANGELOG index 2b4ce95e3..29d9f02e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,6 +22,7 @@ Other: - Changed api for main menu entries. - Enhanced http error pages. - Moved dashboard and select widgets view from projector to core app. +- Created a poll description field for each assignment-poll. Version 1.5.1 (unreleased) diff --git a/openslides/assignment/forms.py b/openslides/assignment/forms.py index a2812216f..8787c7a5a 100644 --- a/openslides/assignment/forms.py +++ b/openslides/assignment/forms.py @@ -9,7 +9,7 @@ from openslides.utils.person import PersonFormField from .models import Assignment -class AssignmentForm(forms.ModelForm, CssClassMixin): +class AssignmentForm(CssClassMixin, forms.ModelForm): posts = forms.IntegerField( min_value=1, initial=1, label=ugettext_lazy("Number of available posts")) @@ -18,8 +18,7 @@ class AssignmentForm(forms.ModelForm, CssClassMixin): exclude = ('status', 'elected') -class AssignmentRunForm(forms.Form, CssClassMixin): +class AssignmentRunForm(CssClassMixin, forms.Form): candidate = PersonFormField( widget=forms.Select(attrs={'class': 'medium-input'}), - label=ugettext_lazy("Nominate a participant"), - ) + label=ugettext_lazy("Nominate a participant")) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 204e1ef31..f666f0608 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -50,9 +50,9 @@ class Assignment(SlideMixin, AbsoluteUrlMixin, models.Model): name = models.CharField(max_length=100, verbose_name=ugettext_lazy("Name")) description = models.TextField(null=True, blank=True, verbose_name=ugettext_lazy("Description")) posts = models.PositiveSmallIntegerField(verbose_name=ugettext_lazy("Number of available posts")) - polldescription = models.CharField( - max_length=100, null=True, blank=True, - verbose_name=ugettext_lazy("Comment on the ballot paper")) + poll_description_default = models.CharField( + max_length=79, null=True, blank=True, + verbose_name=ugettext_lazy("Default comment on the ballot paper")) status = models.CharField(max_length=3, choices=STATUS, default='sea') class Meta: @@ -192,8 +192,8 @@ class Assignment(SlideMixin, AbsoluteUrlMixin, models.Model): return person in self.elected def gen_poll(self): - poll = AssignmentPoll(assignment=self) - poll.save() + poll = AssignmentPoll.objects.create( + assignment=self, description=self.poll_description_default) poll.set_options([{'candidate': person} for person in self.candidates]) return poll @@ -255,9 +255,11 @@ class AssignmentOption(BaseOption): class AssignmentPoll(RelatedModelMixin, CollectInvalid, CollectVotesCast, PublishPollMixin, AbsoluteUrlMixin, BasePoll): option_class = AssignmentOption - assignment = models.ForeignKey(Assignment, related_name='poll_set') yesnoabstain = models.NullBooleanField() + description = models.CharField( + max_length=79, null=True, blank=True, + verbose_name=ugettext_lazy("Comment on the ballot paper")) def __unicode__(self): return _("Ballot %d") % self.get_ballot() @@ -297,3 +299,6 @@ class AssignmentPoll(RelatedModelMixin, CollectInvalid, CollectVotesCast, def get_ballot(self): return self.assignment.poll_set.filter(id__lte=self.id).count() + + def append_pollform_fields(self, fields): + fields.append('description') diff --git a/openslides/assignment/templates/assignment/poll_view.html b/openslides/assignment/templates/assignment/poll_view.html index f170daeaf..5de2d10cf 100644 --- a/openslides/assignment/templates/assignment/poll_view.html +++ b/openslides/assignment/templates/assignment/poll_view.html @@ -25,14 +25,13 @@ -{% if assignment.polldescription %} -
{% trans "Short description (for ballot paper)" %}: {{ assignment.polldescription }}
-{% endif %} - --{% trans "Special values" %}: -1 = {% trans 'majority' %} | -2 = {% trans 'undocumented' %} -