1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-10-31 22:55:48 +00:00

add url to get a qr code which leads to the feedback page for a specific talk

This commit is contained in:
Franzi 2023-02-28 08:27:01 +01:00
parent d86cd011f3
commit 2da018775b
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -1,7 +1,12 @@
import datetime as dt
from xml.etree import ElementTree as ET
import pytz
from django.http import JsonResponse
import qrcode
import qrcode.image.svg
from django.conf import settings
from django.http import HttpResponse, JsonResponse
from django.utils.safestring import mark_safe
from django.views import View
from django.views.generic import FormView
from django.views.generic.base import TemplateView
@ -65,6 +70,17 @@ class BroadcastToolsEventInfoView(View):
)
class BroadcastToolsFeedbackQrCode(View):
def get(self, request, *args, **kwargs):
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
domain = request.event.custom_domain or settings.SITE_URL
image = qrcode.make(
f"{domain}{talk.urls.feedback}", image_factory=qrcode.image.svg.SvgImage
)
svg_data = mark_safe(ET.tostring(image.get_image()).decode())
return HttpResponse(svg_data, content_type="image/svg+xml")
class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, View):
permission_required = "agenda.view_schedule"