1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-27 07:41:02 +00:00
pretalx-plugin-broadcast-tools/pretalx_broadcast_tools/utils/placeholders.py

32 lines
1,006 B
Python

from django.conf import settings
def placeholders(event, talk, supports_html_colour=False):
track_name = str(talk.submission.track.name) if talk.submission.track else ""
result = {
"CODE": talk.submission.code,
"EVENT_SLUG": str(event.slug),
"FEEDBACK_URL": "{}{}".format(
event.custom_domain or settings.SITE_URL,
talk.submission.urls.feedback,
),
"TALK_SLUG": talk.frab_slug,
"TALK_URL": "{}{}".format(
event.custom_domain or settings.SITE_URL,
talk.submission.urls.public,
),
"TRACK_NAME": track_name,
}
if talk.submission.track and supports_html_colour:
result["TRACK_NAME_COLOURED"] = '<span style="color: {}">{}</span>'.format(
talk.submission.track.color, track_name
)
else:
result["TRACK_NAME_COLOURED"] = track_name
# for the americans
result["TRACK_NAME_COLORED"] = result["TRACK_NAME_COLOURED"]
return result