From 6e0d34fbd06e50d8c95849caf909f5fb331fc2c1 Mon Sep 17 00:00:00 2001 From: Dece Date: Thu, 17 Aug 2017 19:25:59 +0200 Subject: [PATCH] Minimal videos section --- label/admin.py | 8 ++++---- label/static/label/css/videos.css | 11 +++++++++++ label/templates/label/videos.html | 25 +++++++++++++++++++++++++ label/urls.py | 11 ++++++----- label/views.py | 14 ++++++++++++-- news/static/news/css/news.css | 9 --------- news/templates/news/news.html | 2 +- static/css/base.css | 9 +++++++++ 8 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 label/static/label/css/videos.css create mode 100644 label/templates/label/videos.html diff --git a/label/admin.py b/label/admin.py index c8b4347..787d469 100644 --- a/label/admin.py +++ b/label/admin.py @@ -1,12 +1,12 @@ from django.contrib import admin -from label.models import Artist, Release, VideoClip +from label import models class ArtistAdmin(admin.ModelAdmin): exclude = ('slug',) -admin.site.register(Artist, ArtistAdmin) -admin.site.register(Release) -admin.site.register(VideoClip) +admin.site.register(models.Artist, ArtistAdmin) +admin.site.register(models.Release) +admin.site.register(models.VideoClip) diff --git a/label/static/label/css/videos.css b/label/static/label/css/videos.css new file mode 100644 index 0000000..c1eced8 --- /dev/null +++ b/label/static/label/css/videos.css @@ -0,0 +1,11 @@ +#content { + text-align: center; +} + +.video h2 { + margin-bottom: 0; +} + +.video .embed { + margin: 1em; +} diff --git a/label/templates/label/videos.html b/label/templates/label/videos.html new file mode 100644 index 0000000..10f48a9 --- /dev/null +++ b/label/templates/label/videos.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% load static %} + + +{% block stylesheets %} + +{% endblock %} + + +{% block content %} +{% for video in videos %} +
+

{{ video.artist }} - {{ video.title }}

+
{{ video.year }}
+
+ {% autoescape off %} + {{ video.embed }} + {% endautoescape %} +
+
+ {% if not forloop.last %} +
+ {% endif %} +{% endfor %} +{% endblock %} diff --git a/label/urls.py b/label/urls.py index e8e35c4..bcbcba0 100644 --- a/label/urls.py +++ b/label/urls.py @@ -1,11 +1,12 @@ from django.conf.urls import url -import label.views +from label import views urlpatterns = [ - url(r'^artists/$', label.views.artists_view, name='artists'), - url(r'^artists/(?P\S+)$', label.views.artist_view, name='artist'), - url(r'^releases/$', label.views.releases_view, name='releases'), - url(r'^releases/(?P\S+)$', label.views.release_view, name='release'), + url(r'^artists/$', views.artists_view, name='artists'), + url(r'^artists/(?P\S+)$', views.artist_view, name='artist'), + url(r'^releases/$', views.releases_view, name='releases'), + url(r'^releases/(?P\S+)$', views.release_view, name='release'), + url(r'^videos/$', views.videos_view, name='videos'), ] diff --git a/label/views.py b/label/views.py index 7c4c069..e682e89 100644 --- a/label/views.py +++ b/label/views.py @@ -1,8 +1,12 @@ from django.shortcuts import get_object_or_404, render import markdown -from label.models import Artist, Release -import label.tools as tools +from label.models import Artist, Release, VideoClip +from label.tools import ( + get_catalog_tag_from_id, + get_contribs, + get_id_from_catalog_tag, +) def artists_view(request): @@ -50,3 +54,9 @@ def release_view(request, tag): contribs = tools.get_contribs(release.contributors.all()) context = { 'release': release, 'contribs': contribs } return render(request, 'label/release.html', context) + + +def videos_view(request): + videos = VideoClip.objects.all() + context = { 'videos': videos } + return render(request, 'label/videos.html', context) diff --git a/news/static/news/css/news.css b/news/static/news/css/news.css index 0bf412d..48d1a01 100644 --- a/news/static/news/css/news.css +++ b/news/static/news/css/news.css @@ -6,12 +6,3 @@ .article .content { text-align: justify; } - -hr { - border-color: #929292 -moz-use-text-color -moz-use-text-color; - border-right: 0px none; - border-style: solid none none; - border-width: 1px 0px 0px; - margin-bottom: 20px; - margin-top: 20px; -} diff --git a/news/templates/news/news.html b/news/templates/news/news.html index f20b8a9..e365297 100644 --- a/news/templates/news/news.html +++ b/news/templates/news/news.html @@ -30,7 +30,7 @@ {% if not forloop.last %} -
+
{% endif %} {% endfor %} diff --git a/static/css/base.css b/static/css/base.css index 8dd1fc2..09b0843 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -96,3 +96,12 @@ nav .link:nth-child(5):hover { background-color: #78dce8; } /* Chrome 19+, Safari 6+ (& iOS), Opera 15+ */ -webkit-filter: grayscale(100%); } + +.grey-line { + border-color: #929292 -moz-use-text-color -moz-use-text-color; + border-right: 0px none; + border-style: solid none none; + border-width: 1px 0px 0px; + margin-bottom: 20px; + margin-top: 20px; +}