Added agenda slides.
This commit is contained in:
parent
fe16afa1a7
commit
6da0d41e50
@ -6,6 +6,10 @@ class AgendaAppConfig(AppConfig):
|
||||
verbose_name = 'OpenSlides Agenda'
|
||||
|
||||
def ready(self):
|
||||
# Load projector elements.
|
||||
# Do this by just importing all from these files.
|
||||
from . import projector # noqa
|
||||
|
||||
# Import all required stuff.
|
||||
from django.db.models.signals import pre_delete
|
||||
from openslides.config.signals import config_signal
|
||||
|
60
openslides/agenda/projector.py
Normal file
60
openslides/agenda/projector.py
Normal file
@ -0,0 +1,60 @@
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from openslides.core.exceptions import ProjectorException
|
||||
from openslides.core.views import TagViewSet
|
||||
from openslides.utils.projector import ProjectorElement, ProjectorRequirement
|
||||
|
||||
from .models import Item
|
||||
from .views import ItemViewSet
|
||||
|
||||
|
||||
class ItemListSlide(ProjectorElement):
|
||||
"""
|
||||
Slide definitions for the agenda.
|
||||
"""
|
||||
name = 'agenda/agenda'
|
||||
|
||||
def get_requirements(self, config_entry):
|
||||
yield ProjectorRequirement(
|
||||
view_class=ItemViewSet,
|
||||
view_action='list')
|
||||
|
||||
|
||||
class ItemDetailSlide(ProjectorElement):
|
||||
"""
|
||||
Slide definitions for Item model.
|
||||
|
||||
To activate this slide as list of speakers slide, set 'list_of_speakers'
|
||||
true.
|
||||
"""
|
||||
name = 'agenda/item'
|
||||
|
||||
def get_context(self):
|
||||
pk = self.config_entry.get('id')
|
||||
if not Item.objects.filter(pk=pk).exists():
|
||||
raise ProjectorException(_('Item does not exist.'))
|
||||
return {'id': pk, 'list_of_speakers': self.config_entry.get('list_of_speakers', False)}
|
||||
|
||||
def get_requirements(self, config_entry):
|
||||
pk = config_entry.get('id')
|
||||
if pk is not None:
|
||||
try:
|
||||
item = Item.objects.get(pk=pk)
|
||||
except Item.DoesNotExist:
|
||||
# Item does not exist. Just do nothing.
|
||||
pass
|
||||
else:
|
||||
yield ProjectorRequirement(
|
||||
view_class=ItemViewSet,
|
||||
view_action='retrieve',
|
||||
pk=str(item.pk))
|
||||
for speaker in item.speaker_set.all():
|
||||
yield ProjectorRequirement(
|
||||
view_class=speaker.user.get_view_class(),
|
||||
view_action='retrieve',
|
||||
pk=str(speaker.user_id))
|
||||
for tag in item.tags.all():
|
||||
yield ProjectorRequirement(
|
||||
view_class=TagViewSet,
|
||||
view_action='retrieve',
|
||||
pk=str(tag.pk))
|
@ -43,7 +43,7 @@ class AssignmentDetailSlide(ProjectorElement):
|
||||
yield ProjectorRequirement(
|
||||
view_class=option.candidate.get_view_class(),
|
||||
view_action='retrieve',
|
||||
pk=str(option.candidate.pk))
|
||||
pk=str(option.candidate_id))
|
||||
for tag in assignment.tags.all():
|
||||
yield ProjectorRequirement(
|
||||
view_class=TagViewSet,
|
||||
|
Loading…
Reference in New Issue
Block a user