mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-21 15:31:01 +00:00
add url to get a qr code which leads to the feedback page for a specific talk
This commit is contained in:
parent
d86cd011f3
commit
2da018775b
1 changed files with 17 additions and 1 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue