| @ -1,14 +1,64 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <title>Detalle del Autor</title> | |||
| </head> | |||
| <body> | |||
| <h1>{{ autor.nombre }}</h1> | |||
| <p>{{ autor.biografia }}</p> | |||
| {% if autor.foto %} | |||
| <img src="{{ autor.foto.url }}" alt="Foto del autor" width="200"> | |||
| {% endif %} | |||
| <a href="{% url 'lista_autores' %}">Volver a la lista de autores</a> | |||
| </body> | |||
| </html> | |||
| {% extends 'base.html' %} | |||
| {% block content %} | |||
| <div class="container-xl"> | |||
| <div class="app-card app-card-notification shadow-sm mb-4"> | |||
| <div class="app-card-header px-4 py-3"> | |||
| <div class="row g-3 align-items-center"> | |||
| <div class="col-12 col-lg-auto text-center text-lg-start"> | |||
| {% if autor.foto %} | |||
| <p><img src="{{ autor.foto.url }}" alt="{{ autor.nombre}}" style="width:200px;height:200px;"></p> | |||
| {% else %} | |||
| <p>No hay imágen disponible</p> | |||
| {% endif %} | |||
| </div> | |||
| <div class="col-12 col-lg-auto text-center text-lg-start"> | |||
| <h4>{{ autor.nombre }}</h4> | |||
| <ul class="notification-meta list-inline mb-0"> | |||
| <li class="list-inline-item">{{ autor.nombre }}</li> | |||
| </ul> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="app-card-body p-4"> | |||
| {% if libros %} | |||
| <table class="table app-table-hover mb-0 text-left"> | |||
| <thead> | |||
| <tr> | |||
| <th class="cell">Título</th> | |||
| <th class="cell">Portada</th> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {% for libro in libros %} | |||
| <tr> | |||
| <td class="cell"><a href="{% url 'detalle_libro' libro.id %}">{{ libro.titulo }}</a></td> | |||
| {% if libro.portada %} | |||
| <td class="cell"><img src="{{ libro.portada.url }}" alt="Portada del libro" width="200"></td> | |||
| {% else %} | |||
| <p>Sin imagen</p> | |||
| {% endif %} | |||
| </tr> | |||
| {% endfor %} | |||
| </tbody> | |||
| </table> | |||
| {% else %} | |||
| <p>No se han encontrado libros para este autor</p> | |||
| {% endif %} | |||
| </div> | |||
| </div> | |||
| <div class="row g-3 mb-4 align-items-center justify-content-between"> | |||
| <div class="col-auto"> | |||
| <a class="btn app-btn-secondary" href="{% url 'lista_libros' %}">Volver al inicio</a> | |||
| </div> | |||
| <div class="col-auto"> | |||
| <a class="btn app-btn-primary" href="{% url 'nuevo_libro' %}">Añadir libro</a> <!-- Faltaría poner el id del autor--> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {% endblock %} | |||
| @ -1,18 +1,34 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <title>Detalle del Libro</title> | |||
| </head> | |||
| <body> | |||
| <h1>{{ libro.titulo }}</h1> | |||
| <p>{{ libro.descripcion }}</p> | |||
| <p><strong>Autor:</strong> {{ libro.autor.nombre }}</p> | |||
| <p><strong>Fecha de Publicación:</strong> {{ libro.fecha_publicacion }}</p> | |||
| {% if libro.portada %} | |||
| <img src="{{ libro.portada.url }}" alt="Portada del libro" width="200"> | |||
| {% endif %} | |||
| {% if libro.archivo %} | |||
| <p><a href="{{ libro.archivo.url }}">Descargar</a></p> | |||
| {% endif %} <a href="{% url 'lista_libros' %}">Volver a la lista de libros</a> | |||
| </body> | |||
| </html> | |||
| {% extends 'base.html' %} | |||
| {% block content %} | |||
| <div class="container-xl"> | |||
| <div class="app-card app-card-notification shadow-sm mb-4"> | |||
| <div class="app-card-header px-4 py-3"> | |||
| <div class="row g-3 align-items-center"> | |||
| <div class="col-12 col-lg-auto text-center text-lg-start"> | |||
| {% if libro.portada %} | |||
| <p><img src="{{ libro.portada.url }}" alt="{{ libro.titulo }}" style="width:200px;height:200px;"></p> | |||
| {% else %} | |||
| <p>No hay imágen disponible</p> | |||
| {% endif %} | |||
| {% if libro.archivo %} | |||
| <p><a href="{{ libro.archivo.url }}">Descargar</a></p> | |||
| {% endif %} | |||
| </div><!--//col--> | |||
| <div class="col-12 col-lg-auto text-center text-lg-start"> | |||
| <h4 class="notification-title mb-1">{{ libro.titulo }}</h4> | |||
| <ul class="notification-meta list-inline mb-0"> | |||
| <li class="list-inline-item">{{ libro.autor.nombre }}</li> | |||
| <li class="list-inline-item">|</li> | |||
| <li class="list-inline-item">{{ libro.fecha_publicacion }}</li> | |||
| <li class="list-inline-item">|</li> | |||
| <li class="list-inline-item"><a href="{% url 'detalle_autor' libro.autor_id %}">{{ libro.autor.nombre }}</a></li> | |||
| </ul> | |||
| </div><!--//col--> | |||
| </tr> | |||
| </div><!--//row--> | |||
| </div><!--//app-card-header--> | |||
| </div><!--//app-card--> | |||
| {% endblock %} | |||
| @ -1,15 +1,18 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <title>Formulario de Autor</title> | |||
| </head> | |||
| <body> | |||
| <h1>{% if form.instance.pk %}Editar Autor{% else %}Nuevo Autor{% endif %}</h1> | |||
| <form method="post" enctype="multipart/form-data"> | |||
| {% csrf_token %} | |||
| {{ form.as_p }} | |||
| <button type="submit">Guardar</button> | |||
| </form> | |||
| <a href="{% url 'lista_autores' %}">Cancelar</a> | |||
| </body> | |||
| </html> | |||
| {% extends 'base.html' %} | |||
| {% block content %} | |||
| <div class="column is-4 is-offset-4"> | |||
| <h3>{% if form.instance.pk %}Editar Autor{% else %}Nuevo Autor{% endif %}</h3> | |||
| <div class="box"> | |||
| <form method="POST" enctype="multipart/form-data"> | |||
| {% csrf_token %} | |||
| {{ form.as_p }} | |||
| <div class="text mb-3"> | |||
| <button type="submit" class="btn app-btn-primary w-100 theme-btn mx-auto">Guardar</button> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| {% endblock %} | |||
| @ -1,15 +1,16 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <title>Formulario de Libro</title> | |||
| </head> | |||
| <body> | |||
| <h1>{% if form.instance.pk %}Editar Libro{% else %}Nuevo Libro{% endif %}</h1> | |||
| <form method="post" enctype="multipart/form-data"> | |||
| {% csrf_token %} | |||
| {{ form.as_p }} | |||
| <button type="submit">Guardar</button> | |||
| </form> | |||
| <a href="{% url 'lista_libros' %}">Cancelar</a> | |||
| </body> | |||
| </html> | |||
| {% extends 'base.html' %} | |||
| {% block content %} | |||
| <div class="column is-4 is-offset-4"> | |||
| <h3>{% if form.instance.pk %}Editar Libro{% else %}Nuevo Libro{% endif %}</h3> | |||
| <div class="box"> | |||
| <form method="POST" enctype="multipart/form-data"> | |||
| {% csrf_token %} | |||
| {{ form.as_p }} | |||
| <div class="text mb-3"> | |||
| <button type="submit" class="btn app-btn-primary w-100 theme-btn mx-auto">Guardar</button> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| {% endblock %} | |||
| @ -0,0 +1,14 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <title>Iniciar Sesión</title> | |||
| </head> | |||
| <body> | |||
| <h2>Iniciar Sesión</h2> | |||
| <form method="post"> | |||
| {% csrf_token %} | |||
| {{ form.as_p }} | |||
| <button type="submit">Ingresar</button> | |||
| </form> | |||
| </body> | |||
| </html> | |||