0b5f75339e
* Fixed agenda permissions * Renamed assignment to assignments, fixed assignments permission names * Renamed mediafile to mediafiles * Renamed motion to motions. Fixed motions permission names
30 lines
894 B
Python
30 lines
894 B
Python
from django.template.loader import render_to_string
|
|
|
|
from openslides.config.api import config
|
|
from openslides.projector.api import SlideError
|
|
|
|
from .models import Mediafile
|
|
|
|
|
|
def mediafile_presentation_as_slide(**kwargs):
|
|
"""
|
|
Return the html code for a presentation of a Mediafile.
|
|
|
|
At the moment, only the presentation of pdfs is supported.
|
|
|
|
The function is registered during app loading.
|
|
"""
|
|
file_pk = kwargs.get('pk', None)
|
|
page_num = kwargs.get('page_num', 1)
|
|
|
|
try:
|
|
pdf = Mediafile.objects.get(
|
|
pk=file_pk,
|
|
filetype__in=Mediafile.PRESENTABLE_FILE_TYPES,
|
|
is_presentable=True)
|
|
except Mediafile.DoesNotExist:
|
|
raise SlideError
|
|
context = {'pdf': pdf, 'page_num': page_num,
|
|
'fullscreen': config['pdf_fullscreen']}
|
|
return render_to_string('mediafiles/presentation_slide.html', context)
|