Browse Source

Campo pista en canciones

politica
Celestino Rey 1 year ago
parent
commit
10d5d62d67
7 changed files with 16 additions and 3 deletions
  1. BIN
      LyricsPy/servicios/instance/songs.db
  2. +2
    -0
      LyricsPy/servicios/lyrics/models.py
  3. +2
    -0
      LyricsPy/servicios/lyrics/paginas.py
  4. +3
    -0
      LyricsPy/servicios/lyrics/templates/add_song.html
  5. +5
    -3
      LyricsPy/servicios/lyrics/templates/album.html
  6. +2
    -0
      LyricsPy/servicios/lyrics/templates/index.html
  7. +2
    -0
      LyricsPy/servicios/lyrics/templates/search.html

BIN
LyricsPy/servicios/instance/songs.db View File


+ 2
- 0
LyricsPy/servicios/lyrics/models.py View File

@ -18,6 +18,8 @@ class Song(db.Model):
author = db.Column(db.String(100), nullable=False)
album_id = db.Column(db.Integer, db.ForeignKey('album.id'), nullable=False)
lyrics = db.Column(db.Text, nullable=False)
pista = db.Column(db.Integer, nullable=False) # Nuevo campo
def __repr__(self):
return f'<Song {self.title}>'

+ 2
- 0
LyricsPy/servicios/lyrics/paginas.py View File

@ -21,6 +21,8 @@ def add_song():
author = request.form['author']
album_id = request.form['album_id']
lyrics = request.form['lyrics']
pista = request.form['pista']
new_song = Song(title=title, author=author, album_id=album_id, lyrics=lyrics)
db.session.add(new_song)


+ 3
- 0
LyricsPy/servicios/lyrics/templates/add_song.html View File

@ -3,6 +3,9 @@
{% block content %}
<h2>Añadir nueva canción</h2>
<form method="POST">
<label for="pista">Nº de pista:</label> <!-- Nuevo campo -->
<input type="number" id="pista" name="pista" required>
<label for="title">Título:</label>
<input type="text" id="title" name="title" required>


+ 5
- 3
LyricsPy/servicios/lyrics/templates/album.html View File

@ -19,14 +19,16 @@
<table id="songTable" class="display">
<thead>
<tr>
<th>Title</th>
<th>Author</th>
<th>Album</th>
<th>Pista</th>
<th>Título</th>
<th>Autor</th>
<th>Álbum</th>
</tr>
</thead>
<tbody>
{% for song in songs %}
<tr>
<td>{{ song.pista }}</td>
<td><a href="{{ url_for('paginas.song', song_id=song.id) }}">{{ song.title }}</a></td>
<td>{{ song.author }}</td>
<td><a href="{{ url_for('paginas.album', album_id=song.album.id) }}">{{ song.album.name }}</a></td>


+ 2
- 0
LyricsPy/servicios/lyrics/templates/index.html View File

@ -12,6 +12,7 @@
<table id="songTable" class="display">
<thead>
<tr>
<th>Pista</th>
<th>Título</th>
<th>Autor</th>
<th>Álbum</th>
@ -20,6 +21,7 @@
<tbody>
{% for song in songs %}
<tr>
<td>{{ song.pista }}</td>
<td><a href="{{ url_for('paginas.song', song_id=song.id) }}">{{ song.title }}</a></td>
<td>{{ song.author }}</td>
<td><a href="{{ url_for('paginas.album', album_id=song.album.id) }}">{{ song.album.name }}</a></td>


+ 2
- 0
LyricsPy/servicios/lyrics/templates/search.html View File

@ -7,6 +7,7 @@
<table id="songTable" class="display">
<thead>
<tr>
<th>Pista</th>
<th>Título</th>
<th>Autor</th>
<th>Álbum</th>
@ -15,6 +16,7 @@
<tbody>
{% for song in songs %}
<tr>
<td>{{ song.pista }}</td>
<td><a href="{{ url_for('paginas.song', song_id=song.id) }}">{{ song.title }}</a></td>
<td>{{ song.author }}</td>
<td><a href="{{ url_for('paginas.album', album_id=song.album.id) }}">{{ song.album.name }}</a></td>


Loading…
Cancel
Save