Tweaked meetecho URLs, with new template string formatting filter.

- Legacy-Id: 11689
This commit is contained in:
Henrik Levkowetz 2016-07-16 17:15:21 +00:00
parent 008f0d4e40
commit 523bfce86d
2 changed files with 11 additions and 1 deletions

View file

@ -335,7 +335,7 @@
<!-- Video stream (meetecho) -->
{% if item.timeslot.location.video_stream_url %}
<a class="btn btn-default btn-xs"
href="{{ item.timeslot.location.video_stream_url }}"
href="{{ item.timeslot.location.video_stream_url|format:item.session }}"
title="Meetecho video stream"><span class="fa fa-video-camera"></span>
</a>
{% endif %}

View file

@ -16,3 +16,13 @@ def xslugify(value):
lowercase. Also strips leading and trailing whitespace.
"""
return _xslugify(value)
@register.filter(is_safe=True)
@stringfilter
def format(format, values):
if not isinstance(values, dict):
tmp = {}
for f in values._meta.fields:
tmp[f.name] = getattr(values, f.name)
values = tmp
return format.format(**values)