2015-06-25 20:36:46 +02:00
|
|
|
from openslides.core.exceptions import ProjectorException
|
|
|
|
from openslides.utils.projector import ProjectorElement, ProjectorRequirement
|
|
|
|
|
|
|
|
from .models import Mediafile
|
|
|
|
from .views import MediafileViewSet
|
|
|
|
|
|
|
|
|
|
|
|
class MediafileSlide(ProjectorElement):
|
|
|
|
"""
|
|
|
|
Slide definitions for Mediafile model.
|
|
|
|
"""
|
|
|
|
name = 'mediafiles/mediafile'
|
|
|
|
|
|
|
|
def get_context(self):
|
|
|
|
try:
|
2015-09-17 22:58:24 +02:00
|
|
|
Mediafile.objects.get(pk=self.config_entry.get('id'))
|
2015-06-25 20:36:46 +02:00
|
|
|
except Mediafile.DoesNotExist:
|
2015-11-21 00:00:31 +01:00
|
|
|
raise ProjectorException('File does not exist.')
|
2015-06-25 20:36:46 +02:00
|
|
|
|
|
|
|
def get_requirements(self, config_entry):
|
|
|
|
pk = config_entry.get('id')
|
|
|
|
if pk is not None:
|
|
|
|
yield ProjectorRequirement(
|
|
|
|
view_class=MediafileViewSet,
|
|
|
|
view_action='retrieve',
|
|
|
|
pk=str(pk))
|