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 Alias
</th> </th>
<td> <td>
<a href="/artists/{{ alias.id }}">{{ alias.romanized_name }}</a> <a href="/artists/{{ alias.slug }}">{{ alias.romanized_name }}</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -10,6 +10,12 @@ def artist_index(request):
def artist_show(request, slug): def artist_show(request, slug):
artist = Artist.objects.filter(slug=slug)[0] 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) 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}) 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 title %}Branches{% endblock %}
{% block content %} {% block content %}
<h1>Branches</h1> <h1>Branches</h1>
<table class="table"> {% for branch in branches %}
<thead> <div class="row song-row branch-{{ branch.acronym }}">
<th>Acronym</th> <div class="col col-md-3">
<th>Logo</th> {% if branch.logo %}
<th>Name</th> <img src="{{ branch.logo.url }}" class="img-fluid">
</thead> {% endif %}
<tbody> </div>
{% for branch in branches %} <div class="col col-md-9">
<tr> <div class="row h-100 align-items-center">
<td>{{ branch.acronym }}</td> <p class="h2"><a href="/taxonomy/branches/{{ branch.acronym }}">{{ branch.name }} [{{ branch.acronym }}]</a></p>
<td> </div>
{% if branch.logo %} </div>
<img src="{{ branch.logo.path }}" width=24> </div>
{% endif %} {% endfor %}
</td>
<td><a href="/taxonomy/branches/{{ branch.acronym }}">{{ branch.name }} [{{ branch.acronym }}]</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %} {% endblock %}

View File

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

View File

@ -8,15 +8,9 @@
</thead> </thead>
<tbody> <tbody>
{% for song in songs %} {% for song in songs %}
<tr> <tr class="song-row branch-{{ song.branch.acronym }}">
<td> <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> <a href="/taxonomy/branches/{{ song.branch.acronym }}">{{ song.branch.acronym }}</a>
{% endif %}
</td> </td>
<td> <td>
<a href="/songs/{{ song.id }}/{{ song.title }}">{{ song.title }}</a> <a href="/songs/{{ song.id }}/{{ song.title }}">{{ song.title }}</a>

View File

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