mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-21 19:51:03 +00:00
add endpoint to get qr code linking to talk detail page
This commit is contained in:
parent
08998e7535
commit
e0f47458cd
2 changed files with 16 additions and 0 deletions
|
@ -24,6 +24,11 @@ urlpatterns = [
|
||||||
views.BroadcastToolsRoomInfoView.as_view(),
|
views.BroadcastToolsRoomInfoView.as_view(),
|
||||||
name="room_info",
|
name="room_info",
|
||||||
),
|
),
|
||||||
|
re_path(
|
||||||
|
f"^(?P<event>[{SLUG_CHARS}]+)/p/broadcast-tools/public-qr/(?P<talk>[0-9]+).svg$",
|
||||||
|
views.BroadcastToolsPublicQrCodeSvg.as_view(),
|
||||||
|
name="public_qr_id",
|
||||||
|
),
|
||||||
re_path(
|
re_path(
|
||||||
f"^(?P<event>[{SLUG_CHARS}]+)/p/broadcast-tools/schedule.json$",
|
f"^(?P<event>[{SLUG_CHARS}]+)/p/broadcast-tools/schedule.json$",
|
||||||
views.BroadcastToolsScheduleView.as_view(),
|
views.BroadcastToolsScheduleView.as_view(),
|
||||||
|
|
|
@ -90,6 +90,17 @@ class BroadcastToolsFeedbackQrCodeSvg(View):
|
||||||
return HttpResponse(svg_data, content_type="image/svg+xml")
|
return HttpResponse(svg_data, content_type="image/svg+xml")
|
||||||
|
|
||||||
|
|
||||||
|
class BroadcastToolsPublicQrCodeSvg(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.public}", 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):
|
class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, View):
|
||||||
permission_required = "agenda.view_schedule"
|
permission_required = "agenda.view_schedule"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue