From ef2b6c7b10424472a2c0654d8de7d9e97d44be6b Mon Sep 17 00:00:00 2001 From: Emilie Date: Wed, 5 Oct 2016 13:56:06 +0200 Subject: [PATCH] Media : templating --- app/organization/media/views.py | 1 - app/templates/media/audio/inc/audio_card.html | 30 +++++++++++++++++++ app/templates/media/media_list.html | 13 +++++--- app/templates/media/video/inc/video_card.html | 18 +++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 app/templates/media/audio/inc/audio_card.html create mode 100644 app/templates/media/video/inc/video_card.html diff --git a/app/organization/media/views.py b/app/organization/media/views.py index 044c90d5..f982dac3 100644 --- a/app/organization/media/views.py +++ b/app/organization/media/views.py @@ -2,7 +2,6 @@ from django.shortcuts import render from organization.media.models import * from organization.core.views import * -from organization.core.utils import * from dal import autocomplete from dal_select2_queryset_sequence.views import Select2QuerySetSequenceView from mezzanine_agenda.models import Event diff --git a/app/templates/media/audio/inc/audio_card.html b/app/templates/media/audio/inc/audio_card.html new file mode 100644 index 00000000..38541296 --- /dev/null +++ b/app/templates/media/audio/inc/audio_card.html @@ -0,0 +1,30 @@ + +
    + + {% for audio in object %} + +
  1. + {{ audio.title }} +
  2. + + {% comment %} + + {# audio.title #}
    + {# audio.open_source_mime_type #}
    + {# audio.closed_source_mime_type #}
    + {# audio.category #}
    + {# audio.media_id #}
    + {# audio.open_source_url #}
    + {# audio.closed_source_url #}
    + {# audio.poster_url #}
    + + + {% endcomment %} + + {% endfor %} + +
diff --git a/app/templates/media/media_list.html b/app/templates/media/media_list.html index 41526d7f..8eadaf47 100644 --- a/app/templates/media/media_list.html +++ b/app/templates/media/media_list.html @@ -28,9 +28,14 @@ {% block page_content %} -{% for m in media %} - {{ m|classname }} : {{ m.created_at }} : {{ m.title }} -
-{% endfor %} + {% for object in media %} + {% with object|classname|lower as class_name %} + {% with "media/"|add:class_name|add:"/inc/"|add:class_name|add:"_card.html" as template %} + {% include template %} + {% endwith %} + {% endwith %} + {{ m|classname }} : {{ m.created_at }} : {{ m.title }} +
+ {% endfor %} {% endblock %} diff --git a/app/templates/media/video/inc/video_card.html b/app/templates/media/video/inc/video_card.html new file mode 100644 index 00000000..0f2df011 --- /dev/null +++ b/app/templates/media/video/inc/video_card.html @@ -0,0 +1,18 @@ +{% for video in videos %} + {% comment %} + {# video.title #}
+ {# video.open_source_mime_type #}
+ {# video.closed_source_mime_type #}
+ {# video.category #}
+ {# video.media_id #}
+ {# video.open_source_url #}
+ {# video.closed_source_url #}
+ {# video.poster_url #}
+ {% endcomment %} + + +{% endfor %} -- 2.39.5