From bdd809cbbfd68359ccf634e6438e9c11e309ce11 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 25 Feb 2016 14:08:00 +0100 Subject: [PATCH] add video views --- app/deploy/start_app.sh | 8 +++---- app/festival/migrations/__init__.py | 0 app/festival/models.py | 3 +++ .../templates/festival/video_detail.html | 24 +++++++++++++++++++ .../templates/festival/video_list.html | 15 ++++++++++++ app/festival/urls.py | 4 +++- app/festival/views.py | 2 +- 7 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 app/festival/migrations/__init__.py create mode 100644 app/festival/templates/festival/video_detail.html create mode 100644 app/festival/templates/festival/video_list.html diff --git a/app/deploy/start_app.sh b/app/deploy/start_app.sh index e94244d6..a7759346 100644 --- a/app/deploy/start_app.sh +++ b/app/deploy/start_app.sh @@ -34,15 +34,15 @@ python $manage migrate --noinput python $manage collectstatic --noinput python $manage create-admin-user -# static files auto update -watchmedo shell-command --patterns="*.js;*.css" --recursive \ - --command='python '$manage' collectstatic --noinput' $src & - # app start if [ $1 = "--runserver" ] then python $manage runserver 0.0.0.0:9000 else + # static files auto update + watchmedo shell-command --patterns="*.js;*.css" --recursive \ + --command='python '$manage' collectstatic --noinput' $src & + uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \ --processes $processes --threads $threads \ --uid $uid --gid $gid \ diff --git a/app/festival/migrations/__init__.py b/app/festival/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/festival/models.py b/app/festival/models.py index 0324bc23..b6ea3c02 100644 --- a/app/festival/models.py +++ b/app/festival/models.py @@ -91,6 +91,9 @@ class Video(Displayable, RichText): def __unicode__(self): return + @property + def html(self): + pass class EventCategory(BaseNameModel): """Event Category""" diff --git a/app/festival/templates/festival/video_detail.html b/app/festival/templates/festival/video_detail.html new file mode 100644 index 00000000..e237ba7f --- /dev/null +++ b/app/festival/templates/festival/video_detail.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} +{% load i18n %} +{% load mezzanine_tags keyword_tags %} + +{% block main %} + +
+

{{ video.title }}

+
+ +
+ {{ video.description }} +
+ +
+ {{ video.html|safe }} +
+ +
+

{% trans 'Related event' %}

+ {{ video.event.title }} +
+ +{% endblock %} diff --git a/app/festival/templates/festival/video_list.html b/app/festival/templates/festival/video_list.html new file mode 100644 index 00000000..33a57d95 --- /dev/null +++ b/app/festival/templates/festival/video_list.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% load i18n %} +{% load mezzanine_tags keyword_tags %} + +{% block main %} + +
+ +
+ +{% endblock %} diff --git a/app/festival/urls.py b/app/festival/urls.py index da5434c4..04aa4905 100644 --- a/app/festival/urls.py +++ b/app/festival/urls.py @@ -10,7 +10,9 @@ from mezzanine.conf import settings from festival.views import * urlpatterns = patterns('', - url(r'^artists/$', ArtistListView.as_view(), name="festival-artists"), + url(r'^artists/$', ArtistListView.as_view(), name="festival-artist-list"), url(r'^artists/(?P.*)/$', ArtistDetailView.as_view(), name="festival-artist-detail"), + url(r'^videos/$', ArtistListView.as_view(), name="festival-video-list"), + url(r'^videos/(?P.*)/$', ArtistDetailView.as_view(), name="festival-video-detail"), ) diff --git a/app/festival/views.py b/app/festival/views.py index b8263ec9..defac746 100644 --- a/app/festival/views.py +++ b/app/festival/views.py @@ -40,7 +40,7 @@ class VideoDetailView(DetailView): model = Video template_name='festival/video_detail.html' - context_object_name = 'artist' + context_object_name = 'video' def get_context_data(self, **kwargs): context = super(VideoDetailView, self).get_context_data(**kwargs) -- 2.39.5