Добавил недостающие шаблоны, добавил related_name в моделях, добавил недостающие urls

This commit is contained in:
Viner Abubakirov
2026-01-02 12:58:36 +05:00
parent 8af3cbee92
commit 6231de70ea
15 changed files with 147 additions and 27 deletions

View File

@@ -4,6 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<link rel="stylesheet" href="{% static '/css/main.css' %}">
{% block head_extra %}{% endblock %}
<title>{% block title %}Музыкальный сервис{% endblock %}</title>

View File

@@ -0,0 +1,11 @@
{% load static %}
<ul>
{% for album in albums %}
<li>
<a href="{% url 'music:album_detail' album.id %}">{{ album.name }}</a> by {{ album.artist }}
</li>
{% empty %}
<li>No albums available.</li>
{% endfor %}
</ul>

View File

@@ -0,0 +1,11 @@
{% load static %}
<ul>
{% for artist in artists %}
<li>
<a href="{% url 'music:artist_detail' artist.id %}">{{ artist.name }}</a>
</li>
{% empty %}
<li>No artists available.</li>
{% endfor %}
</ul>

View File

@@ -0,0 +1,23 @@
{% load static %}
<link rel="stylesheet" href="{% static 'css/track_list.css' %}">
<div class="container">
<ul class="track-list">
{% if tracks %}
{% for track in tracks %}
<li class="track-item" data-track-id="{{ track.id }}" data-track-src="{{ track.file.url }}">
<div class="track-info">
<h3 class="track-title">{{ track.title }}</h3>
<p class="track-artist">Исполнитель: {{ track.album.artist }}</p>
</div>
</li>
{% endfor %}
{% else %}
<div class="empty-state">
<i class="fas fa-music"></i>
<p>Нет добавленных треков</p>
</div>
{% endif %}
</ul>
</div>
{% include 'components/player.html' %}

View File

@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Album Detail{% endblock %}
{% block content %}
<h1>{{ album.name }}</h1>
<p>Artist: {{ album.artist }}</p>
<p>Release Date: {{ album.release_date }}</p>
<h2>Tracks</h2>
{% include 'components/track_list.html' with tracks=album.tracks.all %}
{% endblock %}

View File

@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Album List{% endblock %}
{% block content %}
<h1>Album List</h1>
{% include 'components/album_list.html' with albums=albums %}
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Artist Detail{% endblock %}
{% block content %}
<h1>{{ artist.name }}</h1>
<p>Genre: {{ artist.genre }}</p>
<h2>Albums</h2>
{% include 'components/album_list.html' with albums=artist.albums.all %}
{% endblock %}

View File

@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Artist List{% endblock %}
{% block content %}
<h1>Artist List</h1>
{% include 'components/artist_list.html' with artists=artists %}
{% endblock %}

View File

@@ -1,29 +1,5 @@
{% extends 'base.html' %}
{% load static %}
{% block head_extra %}
<link rel="stylesheet" href="{% static 'css/track_list.css' %}">
{% endblock head_extra %}
{% block content %}
<div class="container">
<ul class="track-list">
{% if tracks %}
{% for track in tracks %}
<li class="track-item" data-track-id="{{ track.id }}" data-track-src="{{ track.file.url }}">
<div class="track-info">
<h3 class="track-title">{{ track.title }}</h3>
<p class="track-artist">Исполнитель: {{ track.album.artist }}</p>
</div>
</li>
{% endfor %}
{% else %}
<div class="empty-state">
<i class="fas fa-music"></i>
<p>Нет добавленных треков</p>
</div>
{% endif %}
</ul>
</div>
{% include 'player.html' %}
{% include 'components/track_list.html' %}
{% endblock %}