1
0
Fork 0

New releases page

This commit is contained in:
Dece 2017-08-17 16:44:26 +02:00
parent 93b56900ad
commit a37c093f56
7 changed files with 68 additions and 52 deletions

View file

@ -1,18 +1,33 @@
#releases {
text-align: center;
max-width: 95%;
margin: auto;
#content {
display: flex;
flex-direction: column;
width: 100%;
}
.release {
/*-o-transition: .5s;*/
/*-ms-transition: .5s;*/
/*-moz-transition: .5s;*/
/*-webkit-transition: .5s;*/
/*transition: .5s;*/
display: flex;
align-items: center;
margin-bottom: 20px;
}
.release td {
padding-left: 10px;
padding-right: 10px;
.release .cover {
flex-shrink: 0;
height: 120px;
width: 300px;
background-image: url('https://f4.bcbits.com/img/a3032423923_10.jpg');
background-size: cover;
}
.release .infos {
margin-left: 10px;
}
.release .infos p {
margin: 0;
}
.release .infos .title {
width: 100%;
font-weight: bold;
font-size: 1.4em;
}

View file

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% load static %}
@ -12,7 +11,6 @@
<h1>{{ artist.name }}</h1>
<table id="infos"><tr>
<td id="left">

View file

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% load static %}
@ -16,7 +15,11 @@
{% if artist.artist_type == 0 %}
<a href="{% url 'artist' artist.slug %}">
<span class="artist">
<div class="logo" style="background-image: url('{{ MEDIA_URL }}{{ artist.image }}');"></div>
<div
class="logo"
style="background-image: url('{{ MEDIA_URL }}{{ artist.image }}');"
>
</div>
{{ artist.name }}
<span class="artist-genre">{{ artist.genre }}</span>
</span>

View file

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% load static %}

View file

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% load static %}
@ -9,32 +8,30 @@
{% block content %}
<table id="releases">
{% for release in releases %}
<tr class="release">
<td>
{{ release.tag }}
</td>
<div class="release">
<div
class="cover"
style="background-image: url('{{ MEDIA_URL }}{{ release.cover }}')">
</div>
<td>
{% for contrib in release.contribs %}
<a href="{% url 'artist' contrib.slug %}">{{ contrib.name }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</td>
<td>
<div class="infos">
<p class="title">
<a href="{% url 'release' release.tag|lower %}">{{ release.title }}</a>
{% if release.release_type == 1 %}(EP){% endif %}
{% if release.release_type == 2 %}(Split){% endif %}
{% if release.release_type == 3 %}(Demo){% endif %}
</td>
</p>
<p class="contributors">
{% for contrib in release.contribs %}
<a href="{% url 'artist' contrib.slug %}">{{ contrib.name }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</p>
<p class="extras">
{{ release.tag }} - {{ release.year }}
</p>
</div>
<td>
{{ release.year }}
</td>
</tr>
</div>
{% endfor %}
</table>
{% endblock %}

View file

@ -1,7 +1,7 @@
def get_catalog_tag_from_id(ident):
return 'IDRE{:0>3d}'.format(ident)
def get_id_from_catalog_tag(tag):
try:
return int(tag[4:])

View file

@ -10,6 +10,7 @@ def artists_view(request):
context = { 'artists': artists }
return render(request, 'label/artists.html', context)
def artist_view(request, slug):
artist = get_object_or_404(Artist, slug = slug)
artist.description = markdown.markdown(artist.description)
@ -21,6 +22,7 @@ def artist_view(request, slug):
context = { 'artist': artist, 'releases': releases }
return render(request, 'label/artist.html', context)
def releases_view(request):
artists = Artist.objects.all()
releases = Release.objects.all()
@ -34,12 +36,14 @@ def releases_view(request):
'tag': release_tag,
'title': release.title,
'contribs': tools.get_contribs(release.contributors.all()),
'year': release.year
'year': release.year,
'cover': release.cover,
})
context = { 'releases': releases_and_infos }
return render(request, 'label/releases.html', context)
def release_view(request, tag):
ident = tools.get_id_from_catalog_tag(tag)
release = get_object_or_404(Release, ident = ident)