6abb0976c2
* Second websocket channel for the projector * Removed use of projector requirements for REST API requests. Refactored data serializing for projector websocket connection. * Refactor the way that the projector autoupdate get its data. * Fixed missing assignment slide title for hidden items. * Release all items for item list slide and list of speakers slide. Fixed error with motion workflow. * Created CollectionElement class which helps to handle autoupdate.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
from ..core.exceptions import ProjectorException
|
|
from ..utils.projector import ProjectorElement
|
|
from .models import Assignment
|
|
|
|
|
|
class AssignmentSlide(ProjectorElement):
|
|
"""
|
|
Slide definitions for Assignment model.
|
|
"""
|
|
name = 'assignments/assignment'
|
|
|
|
def check_data(self):
|
|
if not Assignment.objects.filter(pk=self.config_entry.get('id')).exists():
|
|
raise ProjectorException('Election does not exist.')
|
|
|
|
def get_requirements(self, config_entry):
|
|
try:
|
|
assignment = Assignment.objects.get(pk=config_entry.get('id'))
|
|
except Assignment.DoesNotExist:
|
|
# Assignment does not exist. Just do nothing.
|
|
pass
|
|
else:
|
|
yield assignment
|
|
yield assignment.agenda_item
|
|
for user in assignment.related_users.all():
|
|
yield user
|
|
for poll in assignment.polls.all().prefetch_related('options'):
|
|
for option in poll.options.all():
|
|
yield option.candidate
|