Add video URL field

This commit is contained in:
Ben Sturmfels 2023-07-14 18:37:45 +10:00
parent bde37005bd
commit 97beb8b131
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
3 changed files with 37 additions and 0 deletions

View file

@ -54,6 +54,21 @@
{% autoescape off %}
<div class="abstract pb-4"><p>{{ presentation.abstract_html|safe|clean_text|urlize }}</p></div>
{% endautoescape %}
{% if presentation.videos_split %}
<h2 class="mt-4">Video</h4>
<video controls style="max-width: 640px">
{% for video in presentation.videos_split %}
<source src="{{ video }}">
{% endfor %}
</video>
<p style="margin-top: 1rem">Available formats:</p>
<ul>
{% for video in presentation.videos_split %}
<li>{{ video|urlize }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.28 on 2023-07-14 08:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('symposion_schedule', '0008_auto_20190122_0815'),
]
operations = [
migrations.AddField(
model_name='presentation',
name='videos',
field=models.TextField(blank=True, help_text='One URL per line'),
),
]

View file

@ -280,6 +280,7 @@ class Presentation(models.Model):
verbose_name=_("Section"),
on_delete=models.CASCADE,
)
videos = models.TextField(blank=True, help_text='One URL per line')
def save(self, *args, **kwargs):
self.abstract_html = parse(self.abstract)
@ -304,6 +305,9 @@ class Presentation(models.Model):
def __str__(self):
return "#%s %s (%s)" % (self.number, self.title, self.speaker)
def videos_split(self):
return [v.strip() for v in self.videos.split('\n') if v != '']
class Meta:
ordering = ["slot"]
verbose_name = _("presentation")