Add colors and alias handling

This commit is contained in:
Damillora 2020-12-17 14:12:26 +07:00
parent ee8f443e5d
commit b1f9605fab
6 changed files with 27 additions and 30 deletions

View File

@ -33,7 +33,7 @@
Alias
</th>
<td>
<a href="/artists/{{ alias.id }}">{{ alias.romanized_name }}</a>
<a href="/artists/{{ alias.slug }}">{{ alias.romanized_name }}</a>
</td>
</tr>
{% endfor %}

View File

@ -10,6 +10,12 @@ def artist_index(request):
def artist_show(request, slug):
artist = Artist.objects.filter(slug=slug)[0]
credit_songs = (artist.written_songs.all() | artist.composed_songs.all() | artist.arranged_songs.all()).distinct()
credit_songs = artist.written_songs.all() | artist.composed_songs.all() | artist.arranged_songs.all()
aliases = artist.aliases.all()
outside_songs = OutsideSong.objects.filter(composer=artist)
for alias in aliases:
credit_songs = credit_songs | alias.written_songs.all() | artist.composed_songs.all() | artist.arranged_songs.all()
outside_songs = outside_songs | OutsideSong.objects.filter(composer=alias)
credit_songs = credit_songs.distinct()
outside_songs = outside_songs.distinct()
return render(request,'artists/show.html',{'artist': artist,'credit_songs':credit_songs,'outside_songs':outside_songs})

View File

@ -3,24 +3,18 @@
{% block title %}Branches{% endblock %}
{% block content %}
<h1>Branches</h1>
<table class="table">
<thead>
<th>Acronym</th>
<th>Logo</th>
<th>Name</th>
</thead>
<tbody>
{% for branch in branches %}
<tr>
<td>{{ branch.acronym }}</td>
<td>
{% if branch.logo %}
<img src="{{ branch.logo.path }}" width=24>
{% endif %}
</td>
<td><a href="/taxonomy/branches/{{ branch.acronym }}">{{ branch.name }} [{{ branch.acronym }}]</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% for branch in branches %}
<div class="row song-row branch-{{ branch.acronym }}">
<div class="col col-md-3">
{% if branch.logo %}
<img src="{{ branch.logo.url }}" class="img-fluid">
{% endif %}
</div>
<div class="col col-md-9">
<div class="row h-100 align-items-center">
<p class="h2"><a href="/taxonomy/branches/{{ branch.acronym }}">{{ branch.name }} [{{ branch.acronym }}]</a></p>
</div>
</div>
</div>
{% endfor %}
{% endblock %}

View File

@ -8,7 +8,7 @@
<table class="table">
<tbody>
{% if song.branch %}
<tr>
<tr class="song-row branch-{{ song.branch.acronym }}">
<th scope="row">Branch</th>
<td><a href="/taxonomy/branches/{{ song.branch.acronym }}">[{{ song.branch.acronym }}] {{ song.branch.name }}</a></td>
</tr>

View File

@ -8,15 +8,9 @@
</thead>
<tbody>
{% for song in songs %}
<tr>
<tr class="song-row branch-{{ song.branch.acronym }}">
<td>
{% if song.branch.logo %}
<a href="/taxonomy/branches/{{ song.branch.acronym }}">
<img src="{{ song.branch.logo.url }}" width=24>
</a>
{% else %}
<a href="/taxonomy/branches/{{ song.branch.acronym }}">{{ song.branch.acronym }}</a>
{% endif %}
</td>
<td>
<a href="/songs/{{ song.id }}/{{ song.title }}">{{ song.title }}</a>

View File

@ -1,3 +1,5 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
@ -9,6 +11,7 @@
</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<link href="{% static 'branches.css' %}" rel="stylesheet">
</head>
<body>