From 1a8068f1d3808f88497d04fe20ef69f2143b0355 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 7 Apr 2016 14:37:02 +0200 Subject: [PATCH] add video poster --- .../migrations/0013_auto_20160407_1432.py | 25 +++++++++++++++++++ .../migrations/0014_auto_20160407_1433.py | 25 +++++++++++++++++++ app/festival/models.py | 3 +++ .../templates/festival/inc/video_card.html | 6 +++-- .../templates/festival/video_detail.html | 2 +- app/templates/blog/includes/post_card.html | 14 +++++++++++ app/templates/index.html | 5 ++++ 7 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 app/festival/migrations/0013_auto_20160407_1432.py create mode 100644 app/festival/migrations/0014_auto_20160407_1433.py create mode 100644 app/templates/blog/includes/post_card.html diff --git a/app/festival/migrations/0013_auto_20160407_1432.py b/app/festival/migrations/0013_auto_20160407_1432.py new file mode 100644 index 00000000..e03e859c --- /dev/null +++ b/app/festival/migrations/0013_auto_20160407_1432.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-04-07 12:32 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('festival', '0012_auto_20160405_2351'), + ] + + operations = [ + migrations.AddField( + model_name='audio', + name='poster', + field=models.URLField(blank=True, max_length=1024, verbose_name='poster'), + ), + migrations.AddField( + model_name='video', + name='poster', + field=models.URLField(blank=True, max_length=1024, verbose_name='poster'), + ), + ] diff --git a/app/festival/migrations/0014_auto_20160407_1433.py b/app/festival/migrations/0014_auto_20160407_1433.py new file mode 100644 index 00000000..ac63f684 --- /dev/null +++ b/app/festival/migrations/0014_auto_20160407_1433.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-04-07 12:33 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('festival', '0013_auto_20160407_1432'), + ] + + operations = [ + migrations.RenameField( + model_name='audio', + old_name='poster', + new_name='poster_url', + ), + migrations.RenameField( + model_name='video', + old_name='poster', + new_name='poster_url', + ), + ] diff --git a/app/festival/models.py b/app/festival/models.py index 51dd0fce..487f3202 100644 --- a/app/festival/models.py +++ b/app/festival/models.py @@ -118,6 +118,7 @@ class Media(Displayable, RichText): open_source_url = models.URLField(_('open source URL'), max_length=1024, blank=True) closed_source_url = models.URLField(_('closed source URL'), max_length=1024, blank=True) featured = models.BooleanField(_('featured'), default=False) + poster_url = models.URLField(_('poster'), max_length=1024, blank=True) class Meta(MetaCore): abstract = True @@ -142,6 +143,8 @@ class Media(Displayable, RichText): self.open_source_url = source.attrib['src'] elif self.closed_source_mime_type in source.attrib['type']: self.closed_source_url = source.attrib['src'] + video = self.q('video') + self.poster_url = video[0].attrib['poster'] class Audio(Media): diff --git a/app/festival/templates/festival/inc/video_card.html b/app/festival/templates/festival/inc/video_card.html index 1b35317c..6fe56d1c 100644 --- a/app/festival/templates/festival/inc/video_card.html +++ b/app/festival/templates/festival/inc/video_card.html @@ -1,9 +1,11 @@ +{% load i18n %} +
- +

{{ video.title }}

- Lire la video + {% trans "Play the video" %}
diff --git a/app/festival/templates/festival/video_detail.html b/app/festival/templates/festival/video_detail.html index eea4f39e..e4a7de5e 100644 --- a/app/festival/templates/festival/video_detail.html +++ b/app/festival/templates/festival/video_detail.html @@ -17,7 +17,7 @@
-