Celestino Rey 1 year ago
parent
commit
d55779b32c
20 changed files with 1646 additions and 94 deletions
  1. +1
    -0
      ReyMotaAppsDj/.dockerignore
  2. +1
    -1
      ReyMotaAppsDj/K8S/Makefile
  3. +1
    -1
      ReyMotaAppsDj/K8S/env-prod-configmap.yaml
  4. +1333
    -0
      ReyMotaAppsDj/K8S/libros.sql
  5. +0
    -0
      ReyMotaAppsDj/K8S/lyrics.sql
  6. +14
    -7
      ReyMotaAppsDj/K8S/pv-local-reymota.yaml
  7. +140
    -0
      ReyMotaAppsDj/K8S/vehiculos.sql
  8. +9
    -0
      ReyMotaAppsDj/README.md
  9. +5
    -0
      ReyMotaAppsDj/reymota/libros/admin.py
  10. +6
    -0
      ReyMotaAppsDj/reymota/lyrics/admin.py
  11. +2
    -2
      ReyMotaAppsDj/reymota/lyrics/forms.py
  12. +0
    -0
      ReyMotaAppsDj/reymota/lyrics/management/commands/__init__.py
  13. +23
    -0
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_album.py
  14. +23
    -0
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_artista.py
  15. +25
    -0
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_song.py
  16. +1
    -1
      ReyMotaAppsDj/reymota/lyrics/models.py
  17. +1
    -31
      ReyMotaAppsDj/reymota/lyrics/views.py
  18. +1
    -1
      ReyMotaAppsDj/reymota/repostajes/models.py
  19. +4
    -1
      ReyMotaAppsDj/reymota/reymota/settings.py
  20. +56
    -49
      ReyMotaAppsDj/reymota/templates/lyrics/lista_albumes.html

+ 1
- 0
ReyMotaAppsDj/.dockerignore View File

@ -2,3 +2,4 @@ Dockerfile
Makefile
volcadossql/
venv/
reymota/lyrics/management/

+ 1
- 1
ReyMotaAppsDj/K8S/Makefile View File

@ -1,7 +1,7 @@
export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':')
#export REGISTRY=registry.cube.local
export REGISTRY=registry.reymota.es
export IMG_VERSION = 0.5
export IMG_VERSION = 0.16
export IMG_NGINX_VERSION = 1.0
# limpia todo


+ 1
- 1
ReyMotaAppsDj/K8S/env-prod-configmap.yaml View File

@ -1,6 +1,6 @@
apiVersion: v1
data:
DEBUG: "False"
DEBUG: "True"
DJANGO_ALLOWED_HOSTS: "reymota.es k8s-server localhost 127.0.0.1 [::1]"
CSRF_TRUSTED_ORIGINS: "https://reymota.es"
SECRET_KEY: change_me


+ 1333
- 0
ReyMotaAppsDj/K8S/libros.sql
File diff suppressed because it is too large
View File


+ 0
- 0
ReyMotaAppsDj/K8S/lyrics.sql View File


+ 14
- 7
ReyMotaAppsDj/K8S/pv-local-reymota.yaml View File

@ -11,7 +11,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/media"
#path: "/mnt/Externo/reymota/media"
path: "/mnt/Externo/copiareymota/media"
---
apiVersion: v1
kind: PersistentVolume
@ -26,7 +27,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/migrations/lyrics"
#path: "/mnt/Externo/reymota/migrations/lyrics"
path: "/mnt/Externo/copiareymota/migrations/lyrics"
---
apiVersion: v1
kind: PersistentVolume
@ -41,7 +43,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/migrations/libros"
#path: "/mnt/Externo/reymota/migrations/libros"
path: "/mnt/Externo/copiareymota/migrations/libros"
---
apiVersion: v1
kind: PersistentVolume
@ -56,7 +59,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/migrations/repostajes"
#path: "/mnt/Externo/reymota/migrations/repostajes"
path: "/mnt/Externo/copiareymota/migrations/repostajes"
---
apiVersion: v1
kind: PersistentVolume
@ -71,7 +75,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/migrations/reymotausers"
#path: "/mnt/Externo/reymota/migrations/reymotausers"
path: "/mnt/Externo/copiareymota/migrations/reymotausers"
---
apiVersion: v1
kind: PersistentVolume
@ -86,7 +91,8 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/static"
#path: "/mnt/Externo/reymota/static"
path: "/mnt/Externo/copiareymota/static"
---
apiVersion: v1
kind: PersistentVolume
@ -101,4 +107,5 @@ spec:
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/reymota/pg"
#path: "/mnt/Externo/reymota/pg"
path: "/mnt/Externo/copiareymota/pg"

+ 140
- 0
ReyMotaAppsDj/K8S/vehiculos.sql View File

@ -0,0 +1,140 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.8 (Debian 15.8-1.pgdg120+1)
-- Dumped by pg_dump version 15.8 (Debian 15.8-1.pgdg120+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Data for Name: repostajes_vehiculo; Type: TABLE DATA; Schema: public; Owner: creylopez
--
COPY public.repostajes_vehiculo (id, marca, modelo, matricula, foto) FROM stdin;
5 BMW 318d 1018KPD vehiculos/bmws3.png
4 Toyota Corolla 7630LYR vehiculos/corolla.png
\.
--
-- Name: repostajes_repostaje; Type: TABLE; Schema: public; Owner: creylopez
--
--
-- Data for Name: repostajes_repostaje; Type: TABLE DATA; Schema: public; Owner: creylopez
--
COPY public.repostajes_repostaje (id, fecha, kms, litros, descuento, importe, precioxlitro, kmsrecorridos, consumo, vehiculo_id) FROM stdin;
16 2021-12-14 52731 0.00 0.00 0.00 0.00 52731 0.00 5
17 2021-12-23 53162 52.80 0.00 67.32 1.28 431 12.25 5
18 2021-12-31 54122 49.99 0.00 63.74 1.28 960 5.21 5
19 2022-01-22 54946 49.14 0.00 62.65 1.27 824 5.96 5
20 2022-02-09 55908 49.24 0.00 65.24 1.32 962 5.12 5
21 2022-03-03 56909 48.61 0.00 67.03 1.38 1001 4.86 5
22 2022-03-18 57542 30.06 0.00 52.54 1.75 633 4.75 5
23 2022-04-10 58497 46.63 0.00 69.98 1.50 955 4.88 5
24 2022-05-12 59447 47.14 0.00 72.11 1.53 950 4.96 5
25 2022-05-19 60414 48.57 0.00 79.81 1.64 967 5.02 5
26 2022-06-09 61147 36.20 0.00 62.12 1.72 733 4.94 5
27 2022-06-25 62116 49.17 0.00 90.29 1.84 969 5.07 5
28 2022-09-14 66359 53.24 0.00 84.83 1.59 1174 4.53 5
29 2022-09-23 67107 37.26 0.00 55.48 1.49 748 4.98 5
30 2023-01-24 71790 43.04 2.12 70.54 1.59 871 4.94 5
31 2022-12-03 70061 46.38 2.04 68.13 1.42 903 5.14 5
32 2022-12-26 70919 44.58 1.85 61.68 1.34 858 5.20 5
33 2023-03-05 73711 47.85 0.00 71.20 1.49 948 5.05 5
34 2023-03-25 74749 49.84 0.00 72.17 1.45 1038 4.80 5
35 2023-02-19 72763 49.38 2.34 77.97 1.53 973 5.08 5
36 2023-05-06 76434 32.28 0.00 44.09 1.37 1685 1.92 5
37 2023-05-22 77366 45.04 0.00 58.46 1.30 932 4.83 5
38 2022-07-09 63129 47.03 0.00 79.38 1.69 1013 4.64 5
39 2022-08-12 64088 43.73 0.00 65.55 1.50 959 4.56 5
40 2022-08-22 65185 52.78 0.00 78.80 1.49 1097 4.81 5
41 2022-10-12 68204 52.04 2.51 83.73 1.56 1097 4.74 5
42 2022-11-11 69158 45.28 2.37 78.91 1.69 954 4.75 5
43 2023-06-10 78170 41.09 0.00 54.16 1.32 804 5.11 5
44 2023-06-19 79038 40.78 1.95 60.11 1.43 868 4.70 5
45 2022-06-28 219 9.88 0.00 18.96 1.92 219 4.51 4
46 2022-06-28 236 27.36 0.00 51.33 1.88 17 160.94 4
47 2022-07-14 904 32.24 0.00 55.58 1.72 668 4.83 4
48 2022-07-26 1433 30.49 0.00 48.43 1.59 529 5.76 4
49 2022-08-21 2030 32.92 0.00 46.72 1.42 597 5.51 4
50 2022-09-26 2627 23.92 0.00 33.16 1.39 597 4.01 4
51 2022-10-18 3169 22.97 0.00 32.74 1.43 542 4.24 4
52 2022-11-09 3791 29.60 0.00 41.88 1.41 622 4.76 4
53 2022-11-27 4363 28.80 1.20 38.80 1.35 572 5.03 4
54 2022-12-22 4851 26.74 1.06 34.18 1.28 488 5.48 4
55 2023-01-12 5291 23.52 1.09 35.34 1.50 440 5.35 4
56 2023-02-01 5702 27.36 1.28 41.52 1.52 411 6.66 4
57 2023-02-20 6141 24.09 1.13 36.67 1.52 439 5.49 4
58 2023-03-15 6631 25.52 1.21 38.96 1.53 490 5.21 4
59 2023-04-17 7325 29.40 1.47 47.62 1.62 694 4.24 4
60 2023-05-28 8413 24.16 1.17 37.70 1.56 1088 2.22 4
61 2023-06-25 8956 26.38 1.30 41.94 1.59 543 4.86 4
62 2023-07-10 9471 29.04 1.35 43.49 1.50 515 5.64 4
63 2023-07-14 79875 40.56 1.74 56.26 1.41 837 4.85 5
64 2023-07-22 80806 46.29 1.95 63.05 1.37 931 4.97 5
65 2023-07-25 10043 24.85 1.40 40.32 1.62 572 4.34 4
66 2023-08-07 81695 44.39 0.00 63.88 1.44 889 4.99 5
67 2023-08-09 10582 26.49 1.39 44.94 1.70 539 4.91 4
68 2023-08-23 11050 24.05 1.22 39.40 1.64 468 5.14 4
69 2023-08-27 82715 50.40 0.00 77.06 1.53 1020 4.94 5
70 2023-09-14 11508 21.44 1.14 37.00 1.73 458 4.68 4
71 2023-09-19 83709 48.35 0.00 77.26 1.60 994 4.86 5
72 2023-09-27 84171 23.01 0.00 35.85 1.56 462 4.98 5
73 2023-10-10 85104 48.00 0.00 72.43 1.51 933 5.14 5
74 2023-10-15 12006 25.09 1.25 40.37 1.61 498 5.04 4
75 2023-10-27 86021 46.77 0.00 70.11 1.50 917 5.10 5
76 2023-11-04 12427 25.64 1.17 37.78 1.47 421 6.09 4
77 2023-11-11 86757 39.58 1.71 55.33 1.40 736 5.38 5
78 2023-11-20 12933 26.16 0.00 40.00 1.53 506 5.17 4
79 2023-11-23 87503 42.41 1.75 56.45 1.33 746 5.68 5
80 2023-12-04 88256 41.19 0.00 57.62 1.40 753 5.47 5
81 2023-12-17 88964 41.20 1.66 53.78 1.31 708 5.82 5
82 2024-01-06 13414 30.72 1.34 43.36 1.41 481 6.39 4
83 2024-01-07 89802 47.77 1.91 61.75 1.29 838 5.70 5
84 2024-01-22 13903 25.08 0.00 37.09 1.48 489 5.13 4
85 2024-01-27 90723 45.25 0.00 60.37 1.33 921 4.91 5
86 2024-02-11 14365 28.45 0.00 41.37 1.45 462 6.16 4
87 2024-02-12 91672 48.31 0.00 70.00 1.45 949 5.09 5
88 2024-02-27 92489 41.99 0.00 57.91 1.38 817 5.14 5
89 2024-02-29 14857 23.96 1.12 36.35 1.52 492 4.87 4
90 2024-03-18 15287 13.00 0.00 20.00 1.54 430 3.02 4
91 2024-03-19 93327 43.85 0.00 60.25 1.37 838 5.23 5
92 2024-03-25 15537 19.24 0.00 30.00 1.56 250 7.70 4
93 2024-04-06 15935 29.39 0.00 43.47 1.48 398 7.38 4
94 2024-04-08 94167 41.11 0.00 56.49 1.37 840 4.89 5
95 2024-04-22 16465 25.92 0.00 40.66 1.57 530 4.89 4
96 2024-04-29 95042 43.63 0.00 63.03 1.45 875 4.99 5
97 2024-05-13 16963 26.80 0.00 41.51 1.55 498 5.38 4
98 2024-05-21 96585 28.33 0.00 39.63 1.40 572 4.95 5
99 2024-05-27 97597 49.48 0.00 67.96 1.37 1012 4.89 5
100 2024-05-06 96013 50.59 0.00 73.32 1.45 971 5.21 5
101 2024-06-03 98067 23.97 0.00 32.69 1.36 470 5.10 5
102 2024-06-08 98609 28.28 1.25 40.44 1.43 542 5.22 5
103 2024-06-10 17494 26.72 0.00 39.92 1.49 531 5.03 4
104 2024-06-17 99166 26.91 0.00 36.43 1.35 557 4.83 5
105 2024-06-26 17879 18.91 0.00 28.44 1.50 385 4.91 4
106 2024-06-30 100048 44.39 0.00 61.57 1.39 882 5.03 5
107 2024-07-10 18397 25.42 0.00 38.49 1.51 518 4.91 4
108 2024-07-21 18944 27.71 0.00 40.29 1.45 547 5.07 4
109 2024-07-23 101010 45.25 0.00 60.52 1.34 962 4.70 5
110 2024-08-09 19596 32.19 0.00 43.58 1.35 652 4.94 4
111 2024-08-12 101710 30.69 0.00 39.10 1.27 700 4.38 5
112 2024-08-25 20185 29.08 0.00 38.07 1.31 589 4.94 4
1 2024-08-31 102649 45.27 0.00 55.64 1.23 939 4.82 5
2 2024-09-15 20775 29.51 0.00 39.51 1.34 590 5.00 4
\.

+ 9
- 0
ReyMotaAppsDj/README.md View File

@ -38,3 +38,12 @@ Session Started at: {{ user.last_login }}
## Para funcionar con gunicorn y nginx
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/
## Cambiar la secuencia de lo sid
ALTER SEQUENCE tablename_id_seq RESTART WITH nn;
esto se hace cuando restauro un volcado de la bd sobre una instalación nueva. Si hay índices ya creados, hay que reinciar a partir del último.

+ 5
- 0
ReyMotaAppsDj/reymota/libros/admin.py View File

@ -1,3 +1,8 @@
from django.contrib import admin
# Register your models here.
from .models import Autor, Libro
admin.site.register(Autor)
admin.site.register(Libro)

+ 6
- 0
ReyMotaAppsDj/reymota/lyrics/admin.py View File

@ -1,3 +1,9 @@
from django.contrib import admin
# Register your models here.
from .models import Artista, Album, Song
admin.site.register(Artista)
admin.site.register(Album)
admin.site.register(Song)

+ 2
- 2
ReyMotaAppsDj/reymota/lyrics/forms.py View File

@ -19,8 +19,8 @@ class AlbumForm(forms.ModelForm):
model = Album
fields = ['name', 'artist', 'year', 'cover_image']
year = forms.DateField(
widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}))
# year = forms.DateField(
# widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}))
artist = forms.ModelChoiceField(
queryset=Artista.objects.all(),


+ 0
- 0
ReyMotaAppsDj/reymota/lyrics/management/commands/__init__.py View File


+ 23
- 0
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_album.py View File

@ -0,0 +1,23 @@
from django.core.management.base import BaseCommand, CommandError
from lyrics.models import Album, Artista, Song
import csv
import argparse
from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)

+ 23
- 0
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_artista.py View File

@ -0,0 +1,23 @@
from django.core.management.base import BaseCommand, CommandError
from lyrics.models import Album, Artista, Song
import csv
import argparse
from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)

+ 25
- 0
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_song.py View File

@ -0,0 +1,25 @@
from django.core.management.base import BaseCommand, CommandError
from lyrics.models import Album, Artista, Song
import csv
import argparse
from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
title = row['title'],
artist = row['artist'],
album = row['album'],
year = row['year'],
lyrics = row['lyrics']
pista = row['pista']
print(title, ",", artist, ",", album, ",", year, ",", pista)

+ 1
- 1
ReyMotaAppsDj/reymota/lyrics/models.py View File

@ -23,7 +23,7 @@ class Artista(models.Model):
class Album(models.Model):
name = models.CharField(max_length=200)
artist = models.ForeignKey(Artista, on_delete=models.CASCADE)
year = models.PositiveBigIntegerField(default=current_year(), validators=[MinValueValidator(1984), max_value_current_year])
year = models.PositiveBigIntegerField(default=current_year(), validators=[MinValueValidator(1945), max_value_current_year])
cover_image = models.ImageField(upload_to='cover_image/', blank=True, null=True) # Nuevo campo
def __str__(self):


+ 1
- 31
ReyMotaAppsDj/reymota/lyrics/views.py View File

@ -86,37 +86,7 @@ def nuevo_album(request):
if request.method == 'POST':
form = AlbumForm(request.POST, request.FILES)
if form.is_valid():
instancia = form.save(commit=False)
aplica_descuento = form.cleaned_data['aplica_descuento']
if aplica_descuento:
instancia.descuento = float(instancia.importe) * 0.03
else:
instancia.descuento = 0.0
instancia.importe = float(instancia.importe) - instancia.descuento
if instancia.litros > 0:
instancia.precioxlitro = round(instancia.importe / float(instancia.litros), 2)
else:
instancia.precioxlitro = 0
# lee todos los albumes del vehículo
# albumes = Albums.query.filter_by(artista_id=artista_id).all()
if Album.objects.filter(artista_id=instancia.artista):
albumes = Album.objects.filter(artista_id=instancia.artista).order_by('-fecha')[0]
instancia.kmsrecorridos = instancia.kms - albumes.kms
if instancia.kmsrecorridos > 0:
instancia.consumo = round(instancia.litros * 100 / instancia.kmsrecorridos, 2)
else:
instancia.kmsrecorridos = 0
instancia.consumo = 0
instancia.save()
form.save()
return redirect('lyrics:lista_albumes')
else:


+ 1
- 1
ReyMotaAppsDj/reymota/repostajes/models.py View File

@ -24,4 +24,4 @@ class Repostaje(models.Model):
consumo = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True)
def __str__(self):
return self.fecha
return str(self.fecha)

+ 4
- 1
ReyMotaAppsDj/reymota/reymota/settings.py View File

@ -24,7 +24,8 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-vu#zk4g8pj-qoov#8^i$&s8n_ipp2r3h+o$z1w(1%d=6+i@erm'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# DEBUG = True
DEBUG = os.environ["DEBUG"] == 'True'
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
@ -147,3 +148,5 @@ MEDIA_URL = '/media/'
if DEBUG is False:
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ")
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ")

+ 56
- 49
ReyMotaAppsDj/reymota/templates/lyrics/lista_albumes.html View File

@ -7,56 +7,63 @@
{% endblock menuapp %}
{% block content %}
<div class="container-xl">
<div class="row g-3 mb-4 align-items-center justify-content-between">
<div class="col-auto">
<h1 class="app-page-title mb-0">Álbumes</h1>
</div>
</div><!--//row-->
<div class="col-auto">
<div class="page-utilities">
<div class="row g-4 justify-content-start justify-content-md-end align-items-center">
<div class="col-auto">
<a class="btn app-btn-primary" href="{% url 'lyrics:nuevo_album' %}">Añadir álbum</a>
</div>
</div><!--//row-->
</div><!--//table-utilities-->
</div><!--//col-auto-->
<div class="container-xl">
<div class="row g-3 mb-4 align-items-center justify-content-between">
<div class="col-auto">
<h1 class="app-page-title mb-0">Álbumes</h1>
</div>
</div><!--//row-->
<div class="col-auto">
<div class="page-utilities">
<div class="row g-4 justify-content-start justify-content-md-end align-items-center">
<div class="col-auto">
<a class="btn app-btn-primary" href="{% url 'lyrics:nuevo_album' %}">Añadir álbum</a>
</div>
</div><!--//row-->
</div><!--//table-utilities-->
</div><!--//col-auto-->
<div class="app-card app-card-notification shadow-sm mb-4">
<div class="app-card-body p-4">
<table class="table app-table-hover mb-0 text-left">
<thead>
<tr>
<th class="cell">Fecha</th>
<th class="cell">Vehículo</th>
<th class="cell">Kilómetros</th>
<th class="cell">Litros</th>
<th class="cell">Importe</th>
<th class="cell">Descuento</th>
<th class="cell">Precio por litro</th>
<th class="cell">Kms recorridos</th>
<th class="cell">Consumo/100 kms</th>
</tr>
</thead>
{% for repostaje in repostajes %}
<nav id="orders-table-tab" class="orders-table-tab app-nav-tabs nav shadow-sm flex-column flex-sm-row mb-4">
<a class="flex-sm-fill text-sm-center nav-link" id="albumes-tab" data-bs-toggle="tab" href="#albumes" role="tab" aria-controls="albumes" aria-selected="false">Álbumes</a>
</nav>
<div class="tab-content" id="orders-table-tab-content">
<div class="tab-pane fade show active" id="albumes" role="tabpanel" aria-labelledby="albumes-tab">
<div class="app-card app-card-orders-table shadow-sm mb-5">
<div class="app-card-body">
<div class="table-responsive">
<table class="table app-table-hover mb-0 text-left">
<thead>
<tr>
<tbody>
<tr>
<td class="cell"><a href="{% url 'repostajes:detalle_repostaje' repostaje.id %}">{{ repostaje.fecha }}</a></td>
<td class="cell"><a href="{% url 'repostajes:detalle_vehiculo' repostaje.vehiculo.id %}">{{ repostaje.vehiculo.matricula }}</a></td>
<td class="cell">{{ repostaje.kms }}</td>
<td class="cell">{{ repostaje.litros }}</td>
<td class="cell">{{ repostaje.importe }} €</td>
<td class="cell">{{ repostaje.descuento }} €</td>
<td class="cell">{{ repostaje.precioxlitro }} €</td>
<td class="cell">{{ repostaje.kmsrecorridos }}</td>
<td class="cell">{{ repostaje.consumo }}</td>
</tr>
</tbody>
{% endfor %}
</table>
</div>
</div><!--//container-fluid-->
<th class="cell">Cover</th>
<th class="cell">Nombre</th>
<th class="cell">Artista</th>
<th class="cell">Año</th>
</tr>
</thead>
<tbody>
{% for album in albumes %}
<tr>
<td class="cell">
{% if album.cover_image %}
<img src="{{ album.cover_image.url }}" alt="{{ album.name }}" style="width:50px;height:50px;">
{% else %}
Sin imágen
{% endif %}
</td>
<td class="cell"><a href="{% url 'lyrics:detalle_album' album_id=album.id %}">{{ album.name }}</a></td>
<td class="cell">{{ album.artist }}</td>
<td class="cell">{{ album.year }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div><!--//table-responsive-->
</div><!--//app-card-body-->
</div><!--//app-card-->
</div><!--//tab-pane-->
</div><!--//tab-content-->
</div><!--//container-fluid-->
{% endblock %}

Loading…
Cancel
Save