1
0
Fork 0

Minimal videos section

This commit is contained in:
Dece 2017-08-17 19:25:59 +02:00
parent 2f9956756e
commit 6e0d34fbd0
8 changed files with 68 additions and 21 deletions

View file

@ -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)

View file

@ -0,0 +1,11 @@
#content {
text-align: center;
}
.video h2 {
margin-bottom: 0;
}
.video .embed {
margin: 1em;
}

View file

@ -0,0 +1,25 @@
{% extends "base.html" %}
{% load static %}
{% block stylesheets %}
<link rel="stylesheet" href="{% static 'label/css/videos.css' %}" />
{% endblock %}
{% block content %}
{% for video in videos %}
<div class="video">
<h2>{{ video.artist }} - {{ video.title }}</h2>
<div class="subtitle">{{ video.year }}</div>
<div class="embed">
{% autoescape off %}
{{ video.embed }}
{% endautoescape %}
</div>
</div>
{% if not forloop.last %}
<hr class="grey-line" />
{% endif %}
{% endfor %}
{% endblock %}

View file

@ -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<slug>\S+)$', label.views.artist_view, name='artist'),
url(r'^releases/$', label.views.releases_view, name='releases'),
url(r'^releases/(?P<tag>\S+)$', label.views.release_view, name='release'),
url(r'^artists/$', views.artists_view, name='artists'),
url(r'^artists/(?P<slug>\S+)$', views.artist_view, name='artist'),
url(r'^releases/$', views.releases_view, name='releases'),
url(r'^releases/(?P<tag>\S+)$', views.release_view, name='release'),
url(r'^videos/$', views.videos_view, name='videos'),
]

View file

@ -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)

View file

@ -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;
}

View file

@ -30,7 +30,7 @@
</div>
</article>
{% if not forloop.last %}
<hr />
<hr class="grey-line" />
{% endif %}
{% endfor %}

View file

@ -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;
}