2015-01-25 15:10:34 +01:00
|
|
|
from django.contrib.contenttypes.fields import GenericRelation
|
2012-07-10 11:27:06 +02:00
|
|
|
from django.db import models
|
2013-07-08 14:08:27 +02:00
|
|
|
from django.utils.datastructures import SortedDict
|
2013-09-25 10:01:01 +02:00
|
|
|
from django.utils.translation import ugettext as _
|
|
|
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2014-01-12 11:03:43 +01:00
|
|
|
from openslides.agenda.models import Item, Speaker
|
2013-09-25 10:01:01 +02:00
|
|
|
from openslides.config.api import config
|
2015-06-16 10:37:23 +02:00
|
|
|
from openslides.core.models import Tag
|
|
|
|
from openslides.poll.models import (
|
|
|
|
BaseOption,
|
|
|
|
BasePoll,
|
|
|
|
BaseVote,
|
|
|
|
CollectDefaultVotesMixin,
|
|
|
|
PublishPollMixin,
|
|
|
|
)
|
2015-01-17 14:01:44 +01:00
|
|
|
from openslides.projector.models import SlideMixin
|
2015-06-16 10:37:23 +02:00
|
|
|
from openslides.users.models import User
|
2014-01-12 11:03:43 +01:00
|
|
|
from openslides.utils.exceptions import OpenSlidesError
|
2015-01-17 14:25:05 +01:00
|
|
|
from openslides.utils.rest_api import RESTModelMixin
|
2012-06-23 11:41:32 +02:00
|
|
|
|
2012-04-21 21:38:59 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
class AssignmentRelatedUser(RESTModelMixin, models.Model):
|
2013-10-03 21:49:51 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
Many to Many table between an assignment and user.
|
2013-10-03 21:49:51 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
STATUS_CANDIDATE = 1
|
|
|
|
STATUS_ELECTED = 2
|
|
|
|
STATUS_BLOCKED = 3
|
|
|
|
STATUSES = (
|
|
|
|
(STATUS_CANDIDATE, ugettext_lazy('candidate')),
|
|
|
|
(STATUS_ELECTED, ugettext_lazy('elected')),
|
|
|
|
(STATUS_BLOCKED, ugettext_lazy('blocked')),
|
|
|
|
)
|
|
|
|
|
|
|
|
assignment = models.ForeignKey(
|
|
|
|
'Assignment',
|
|
|
|
db_index=True,
|
|
|
|
related_name='assignment_related_users')
|
|
|
|
user = models.ForeignKey(User, db_index=True)
|
|
|
|
status = models.IntegerField(
|
|
|
|
choices=STATUSES,
|
|
|
|
default=STATUS_CANDIDATE)
|
2012-08-03 13:49:05 +02:00
|
|
|
|
2013-10-03 21:49:51 +02:00
|
|
|
class Meta:
|
2015-01-25 15:10:34 +01:00
|
|
|
unique_together = ('assignment', 'user')
|
2013-10-03 21:49:51 +02:00
|
|
|
|
2014-08-16 09:25:18 +02:00
|
|
|
def __str__(self):
|
2015-01-25 15:10:34 +01:00
|
|
|
return "%s <-> %s" % (self.assignment, self.user)
|
2012-08-03 13:49:05 +02:00
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
def get_root_rest_element(self):
|
|
|
|
"""
|
2015-01-24 16:35:50 +01:00
|
|
|
Returns the assignment to this instance which is the root REST element.
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
|
|
|
return self.assignment
|
|
|
|
|
2012-08-03 13:49:05 +02:00
|
|
|
|
2015-06-16 10:37:23 +02:00
|
|
|
class Assignment(RESTModelMixin, SlideMixin, models.Model):
|
2013-08-04 12:59:11 +02:00
|
|
|
slide_callback_name = 'assignment'
|
|
|
|
|
2015-03-29 15:49:37 +02:00
|
|
|
PHASE_SEARCH = 0
|
|
|
|
PHASE_VOTING = 1
|
|
|
|
PHASE_FINISHED = 2
|
2015-01-25 15:10:34 +01:00
|
|
|
|
|
|
|
PHASES = (
|
|
|
|
(PHASE_SEARCH, ugettext_lazy('Searching for candidates')),
|
|
|
|
(PHASE_VOTING, ugettext_lazy('Voting')),
|
|
|
|
(PHASE_FINISHED, ugettext_lazy('Finished')),
|
2011-07-31 10:46:29 +02:00
|
|
|
)
|
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
title = models.CharField(
|
|
|
|
max_length=100,
|
|
|
|
verbose_name=ugettext_lazy("Title"))
|
|
|
|
"""
|
|
|
|
Title of the assignment.
|
|
|
|
"""
|
|
|
|
|
|
|
|
description = models.TextField(
|
|
|
|
blank=True,
|
|
|
|
verbose_name=ugettext_lazy("Description"))
|
|
|
|
"""
|
|
|
|
Text to describe the assignment.
|
|
|
|
"""
|
|
|
|
|
|
|
|
open_posts = models.PositiveSmallIntegerField(
|
|
|
|
verbose_name=ugettext_lazy("Number of members to be elected"))
|
|
|
|
"""
|
|
|
|
The number of members to be elected.
|
|
|
|
"""
|
|
|
|
|
2014-01-11 17:07:47 +01:00
|
|
|
poll_description_default = models.CharField(
|
2015-01-25 15:10:34 +01:00
|
|
|
max_length=79,
|
|
|
|
blank=True,
|
2014-01-11 17:07:47 +01:00
|
|
|
verbose_name=ugettext_lazy("Default comment on the ballot paper"))
|
2015-01-25 15:10:34 +01:00
|
|
|
"""
|
|
|
|
Default text for the poll description.
|
|
|
|
"""
|
|
|
|
|
|
|
|
phase = models.IntegerField(
|
|
|
|
choices=PHASES,
|
|
|
|
default=PHASE_SEARCH)
|
|
|
|
"""
|
|
|
|
Phase in which the assignment is.
|
|
|
|
"""
|
|
|
|
|
|
|
|
related_users = models.ManyToManyField(
|
|
|
|
User,
|
|
|
|
through='AssignmentRelatedUser')
|
|
|
|
"""
|
|
|
|
Users that a candidates, elected or blocked as candidate.
|
|
|
|
|
|
|
|
See AssignmentRelatedUser for more infos.
|
|
|
|
"""
|
|
|
|
|
2014-12-26 13:45:13 +01:00
|
|
|
tags = models.ManyToManyField(Tag, blank=True)
|
2015-01-25 15:10:34 +01:00
|
|
|
"""
|
|
|
|
Tags for the assignment.
|
|
|
|
"""
|
|
|
|
|
|
|
|
items = GenericRelation(Item)
|
|
|
|
"""
|
|
|
|
Agenda items for this assignment.
|
|
|
|
"""
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2013-08-04 12:59:11 +02:00
|
|
|
class Meta:
|
|
|
|
permissions = (
|
2015-03-26 05:36:10 +01:00
|
|
|
('can_see', ugettext_noop('Can see elections')),
|
2015-01-25 15:10:34 +01:00
|
|
|
('can_nominate_other', ugettext_noop('Can nominate another participant')),
|
2013-08-04 12:59:11 +02:00
|
|
|
('can_nominate_self', ugettext_noop('Can nominate oneself')),
|
2015-03-26 05:36:10 +01:00
|
|
|
('can_manage', ugettext_noop('Can manage elections')),
|
2013-08-04 12:59:11 +02:00
|
|
|
)
|
2015-01-25 15:10:34 +01:00
|
|
|
ordering = ('title', )
|
2013-11-16 20:20:53 +01:00
|
|
|
verbose_name = ugettext_noop('Election')
|
2013-08-04 12:59:11 +02:00
|
|
|
|
2014-08-16 09:25:18 +02:00
|
|
|
def __str__(self):
|
2015-01-25 15:10:34 +01:00
|
|
|
return self.title
|
2013-08-04 12:59:11 +02:00
|
|
|
|
2013-10-03 21:49:51 +02:00
|
|
|
def get_slide_context(self, **context):
|
2015-01-25 15:10:34 +01:00
|
|
|
"""
|
|
|
|
Retuns the context to generate the assignment slide.
|
|
|
|
"""
|
|
|
|
return super().get_slide_context(
|
|
|
|
polls=self.polls.filter(published=True),
|
|
|
|
vote_results=self.vote_results(only_published=True),
|
|
|
|
**context)
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
@property
|
|
|
|
def candidates(self):
|
2011-07-31 10:46:29 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
Queryset that represents the candidates for the assignment.
|
2011-07-31 10:46:29 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
return self.related_users.filter(
|
|
|
|
assignmentrelateduser__status=AssignmentRelatedUser.STATUS_CANDIDATE)
|
2012-09-13 14:59:14 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
@property
|
|
|
|
def elected(self):
|
|
|
|
"""
|
|
|
|
Queryset that represents all elected users for the assignment.
|
|
|
|
"""
|
|
|
|
return self.related_users.filter(
|
|
|
|
assignmentrelateduser__status=AssignmentRelatedUser.STATUS_ELECTED)
|
2012-09-13 14:59:14 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
@property
|
|
|
|
def blocked(self):
|
2012-09-06 15:57:42 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
Queryset that represents all blocked users for the assignment.
|
2012-09-06 15:57:42 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
return self.related_users.filter(
|
|
|
|
assignmentrelateduser__status=AssignmentRelatedUser.STATUS_BLOCKED)
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def is_candidate(self, user):
|
2012-09-13 14:59:14 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
Returns True if user is a candidate.
|
|
|
|
|
|
|
|
Costs one database query.
|
2012-09-13 14:59:14 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
return self.candidates.filter(pk=user.pk).exists()
|
2012-09-13 14:59:14 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def is_elected(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user is elected for this assignment.
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
Costs one database query.
|
|
|
|
"""
|
|
|
|
return self.elected.filter(pk=user.pk).exists()
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def is_blocked(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user is blockt for candidature.
|
|
|
|
|
|
|
|
Costs one database query.
|
|
|
|
"""
|
|
|
|
return self.blocked.filter(pk=user.pk).exists()
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def set_candidate(self, user):
|
|
|
|
"""
|
|
|
|
Adds the user as candidate.
|
|
|
|
"""
|
|
|
|
related_user, __ = self.assignment_related_users.update_or_create(
|
|
|
|
user=user,
|
|
|
|
defaults={'status': AssignmentRelatedUser.STATUS_CANDIDATE})
|
2012-07-03 00:05:48 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def set_elected(self, user):
|
|
|
|
"""
|
|
|
|
Makes user an elected user for this assignment.
|
|
|
|
"""
|
|
|
|
related_user, __ = self.assignment_related_users.update_or_create(
|
|
|
|
user=user,
|
|
|
|
defaults={'status': AssignmentRelatedUser.STATUS_ELECTED})
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def set_blocked(self, user):
|
|
|
|
"""
|
|
|
|
Block user from this assignment, so he can not get an candidate.
|
|
|
|
"""
|
|
|
|
related_user, __ = self.assignment_related_users.update_or_create(
|
|
|
|
user=user,
|
|
|
|
defaults={'status': AssignmentRelatedUser.STATUS_BLOCKED})
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def delete_related_user(self, user):
|
|
|
|
"""
|
|
|
|
Delete the connection from the assignment to the user.
|
|
|
|
"""
|
|
|
|
self.assignment_related_users.filter(user=user).delete()
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def set_phase(self, phase):
|
|
|
|
"""
|
|
|
|
Sets the phase attribute of the assignment.
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
Raises a ValueError if the phase is not valide.
|
|
|
|
"""
|
|
|
|
if phase not in dict(self.PHASES):
|
|
|
|
raise ValueError("Invalid phase %s" % phase)
|
2012-08-03 18:56:00 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
self.phase = phase
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
def create_poll(self):
|
2014-01-12 11:03:43 +01:00
|
|
|
"""
|
2015-06-14 23:26:06 +02:00
|
|
|
Creates a new poll for the assignment and adds all candidates to all
|
2014-01-12 11:03:43 +01:00
|
|
|
lists of speakers of related agenda items.
|
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
candidates = self.candidates.all()
|
|
|
|
|
|
|
|
# Find out the method of the election
|
2015-06-16 18:12:59 +02:00
|
|
|
if config['assignments_poll_vote_values'] == 'votes':
|
2014-05-12 17:56:07 +02:00
|
|
|
yesnoabstain = False
|
2015-06-16 18:12:59 +02:00
|
|
|
elif config['assignments_poll_vote_values'] == 'yesnoabstain':
|
2014-05-12 17:56:07 +02:00
|
|
|
yesnoabstain = True
|
|
|
|
else:
|
2015-06-16 18:12:59 +02:00
|
|
|
# config['assignments_poll_vote_values'] == 'auto'
|
2014-05-12 17:56:07 +02:00
|
|
|
# candidates <= available posts -> yes/no/abstain
|
2015-01-25 15:10:34 +01:00
|
|
|
if len(candidates) <= (self.open_posts - self.elected.count()):
|
2014-05-12 17:56:07 +02:00
|
|
|
yesnoabstain = True
|
|
|
|
else:
|
|
|
|
yesnoabstain = False
|
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
# Create the poll with the candidates.
|
|
|
|
poll = self.polls.create(
|
2014-05-12 17:56:07 +02:00
|
|
|
description=self.poll_description_default,
|
|
|
|
yesnoabstain=yesnoabstain)
|
2015-01-25 15:10:34 +01:00
|
|
|
poll.set_options({'candidate': user} for user in candidates)
|
2014-05-12 17:56:07 +02:00
|
|
|
|
2015-01-25 15:10:34 +01:00
|
|
|
# Add all candidates to all agenda items for this assignment
|
|
|
|
# TODO: Try to do this in a bulk create
|
|
|
|
for item in self.items.all():
|
2014-01-12 11:03:43 +01:00
|
|
|
for candidate in self.candidates:
|
|
|
|
try:
|
2015-01-17 14:01:44 +01:00
|
|
|
Speaker.objects.add(candidate, item)
|
2014-01-12 11:03:43 +01:00
|
|
|
except OpenSlidesError:
|
|
|
|
# The Speaker is already on the list. Do nothing.
|
|
|
|
# TODO: Find a smart way not to catch the error concerning AnonymousUser.
|
|
|
|
pass
|
2014-05-12 17:56:07 +02:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
return poll
|
|
|
|
|
2012-07-10 00:47:00 +02:00
|
|
|
def vote_results(self, only_published):
|
2012-07-03 00:05:48 +02:00
|
|
|
"""
|
2015-01-25 15:10:34 +01:00
|
|
|
Returns a table represented as a list with all candidates from all
|
2012-07-04 11:00:58 +02:00
|
|
|
related polls and their vote results.
|
2012-07-03 00:05:48 +02:00
|
|
|
"""
|
2013-07-08 14:08:27 +02:00
|
|
|
vote_results_dict = SortedDict()
|
2015-01-25 15:10:34 +01:00
|
|
|
|
|
|
|
polls = self.polls.all()
|
2012-07-10 00:47:00 +02:00
|
|
|
if only_published:
|
|
|
|
polls = polls.filter(published=True)
|
2015-01-25 15:10:34 +01:00
|
|
|
|
2012-07-04 11:00:58 +02:00
|
|
|
# All PollOption-Objects related to this assignment
|
2012-07-03 00:05:48 +02:00
|
|
|
options = []
|
2012-07-02 20:32:13 +02:00
|
|
|
for poll in polls:
|
|
|
|
options += poll.get_options()
|
2012-07-03 00:05:48 +02:00
|
|
|
|
|
|
|
for option in options:
|
|
|
|
candidate = option.candidate
|
|
|
|
if candidate in vote_results_dict:
|
|
|
|
continue
|
|
|
|
vote_results_dict[candidate] = []
|
2012-07-02 20:32:13 +02:00
|
|
|
for poll in polls:
|
2012-07-10 00:47:00 +02:00
|
|
|
votes = {}
|
2012-07-03 00:05:48 +02:00
|
|
|
try:
|
2012-07-04 16:05:31 +02:00
|
|
|
# candidate related to this poll
|
|
|
|
poll_option = poll.get_options().get(candidate=candidate)
|
|
|
|
for vote in poll_option.get_votes():
|
2012-07-13 11:16:06 +02:00
|
|
|
votes[vote.value] = vote.print_weight()
|
2012-07-03 00:05:48 +02:00
|
|
|
except AssignmentOption.DoesNotExist:
|
2012-07-04 11:00:58 +02:00
|
|
|
# candidate not in related to this poll
|
2012-07-10 00:47:00 +02:00
|
|
|
votes = None
|
2012-07-04 16:05:31 +02:00
|
|
|
vote_results_dict[candidate].append(votes)
|
2012-07-03 00:05:48 +02:00
|
|
|
return vote_results_dict
|
|
|
|
|
2012-06-23 10:27:58 +02:00
|
|
|
def get_agenda_title(self):
|
2015-01-25 15:10:34 +01:00
|
|
|
return str(self)
|
2012-04-21 21:38:59 +02:00
|
|
|
|
2013-09-07 00:18:13 +02:00
|
|
|
def get_agenda_title_supplement(self):
|
|
|
|
return '(%s)' % _('Assignment')
|
|
|
|
|
2012-02-19 19:27:00 +01:00
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
class AssignmentVote(RESTModelMixin, BaseVote):
|
2012-07-13 11:16:06 +02:00
|
|
|
option = models.ForeignKey('AssignmentOption')
|
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
def get_root_rest_element(self):
|
|
|
|
"""
|
2015-01-24 16:35:50 +01:00
|
|
|
Returns the assignment to this instance which is the root REST element.
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
|
|
|
return self.option.poll.assignment
|
|
|
|
|
2012-07-13 11:16:06 +02:00
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
class AssignmentOption(RESTModelMixin, BaseOption):
|
2012-07-13 11:16:06 +02:00
|
|
|
poll = models.ForeignKey('AssignmentPoll')
|
2014-10-11 14:34:49 +02:00
|
|
|
candidate = models.ForeignKey(User)
|
2012-07-13 11:16:06 +02:00
|
|
|
vote_class = AssignmentVote
|
2012-02-19 19:27:00 +01:00
|
|
|
|
2014-08-16 09:25:18 +02:00
|
|
|
def __str__(self):
|
|
|
|
return str(self.candidate)
|
2012-02-19 19:27:00 +01:00
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
def get_root_rest_element(self):
|
|
|
|
"""
|
2015-01-24 16:35:50 +01:00
|
|
|
Returns the assignment to this instance which is the root REST element.
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
|
|
|
return self.poll.assignment
|
2012-02-19 19:27:00 +01:00
|
|
|
|
2015-01-17 14:25:05 +01:00
|
|
|
|
|
|
|
class AssignmentPoll(RESTModelMixin, SlideMixin, CollectDefaultVotesMixin,
|
2015-06-16 10:37:23 +02:00
|
|
|
PublishPollMixin, BasePoll):
|
2013-10-17 11:34:54 +02:00
|
|
|
slide_callback_name = 'assignmentpoll'
|
2012-02-19 19:27:00 +01:00
|
|
|
option_class = AssignmentOption
|
2015-01-25 15:10:34 +01:00
|
|
|
|
|
|
|
assignment = models.ForeignKey(Assignment, related_name='polls')
|
2014-10-12 11:11:54 +02:00
|
|
|
yesnoabstain = models.BooleanField(default=False)
|
2014-01-11 17:07:47 +01:00
|
|
|
description = models.CharField(
|
2015-01-25 15:10:34 +01:00
|
|
|
max_length=79,
|
|
|
|
blank=True,
|
2014-01-11 17:07:47 +01:00
|
|
|
verbose_name=ugettext_lazy("Comment on the ballot paper"))
|
2012-02-19 19:27:00 +01:00
|
|
|
|
2014-08-16 09:25:18 +02:00
|
|
|
def __str__(self):
|
2013-10-03 21:49:51 +02:00
|
|
|
return _("Ballot %d") % self.get_ballot()
|
|
|
|
|
2012-02-19 19:27:00 +01:00
|
|
|
def get_assignment(self):
|
|
|
|
return self.assignment
|
|
|
|
|
2012-06-18 09:48:27 +02:00
|
|
|
def get_vote_values(self):
|
2012-06-28 20:11:16 +02:00
|
|
|
if self.yesnoabstain:
|
2012-11-24 14:01:21 +01:00
|
|
|
return [ugettext_noop('Yes'), ugettext_noop('No'), ugettext_noop('Abstain')]
|
2012-06-18 09:48:27 +02:00
|
|
|
else:
|
2012-07-10 12:11:07 +02:00
|
|
|
return [ugettext_noop('Votes')]
|
2012-06-18 09:48:27 +02:00
|
|
|
|
2012-04-18 19:02:41 +02:00
|
|
|
def get_ballot(self):
|
2015-01-25 15:10:34 +01:00
|
|
|
return self.assignment.polls.filter(id__lte=self.pk).count()
|
2014-01-11 17:07:47 +01:00
|
|
|
|
2014-04-10 20:18:22 +02:00
|
|
|
def get_percent_base_choice(self):
|
2015-06-16 18:12:59 +02:00
|
|
|
return config['assignments_poll_100_percent_base']
|
2014-04-10 20:18:22 +02:00
|
|
|
|
2014-01-11 17:07:47 +01:00
|
|
|
def append_pollform_fields(self, fields):
|
|
|
|
fields.append('description')
|
2015-01-25 15:10:34 +01:00
|
|
|
super().append_pollform_fields(fields)
|
2013-10-17 11:34:54 +02:00
|
|
|
|
|
|
|
def get_slide_context(self, **context):
|
2015-01-25 15:10:34 +01:00
|
|
|
return super().get_slide_context(poll=self)
|
2015-01-17 14:25:05 +01:00
|
|
|
|
|
|
|
def get_root_rest_element(self):
|
|
|
|
"""
|
2015-01-24 16:35:50 +01:00
|
|
|
Returns the assignment to this instance which is the root REST element.
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
|
|
|
return self.assignment
|