1
0
mirror of https://github.com/Damillora/Altessimo synced 2024-11-24 22:57:32 +00:00

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">
<thead>
<th>Acronym</th>
<th>Logo</th>
<th>Name</th>
</thead>
<tbody>
{% for branch in branches %} {% for branch in branches %}
<tr> <div class="row song-row branch-{{ branch.acronym }}">
<td>{{ branch.acronym }}</td> <div class="col col-md-3">
<td>
{% if branch.logo %} {% if branch.logo %}
<img src="{{ branch.logo.path }}" width=24> <img src="{{ branch.logo.url }}" class="img-fluid">
{% endif %} {% endif %}
</td> </div>
<td><a href="/taxonomy/branches/{{ branch.acronym }}">{{ branch.name }} [{{ branch.acronym }}]</a></td> <div class="col col-md-9">
</tr> <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 %} {% 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>