-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
518 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Book | ||
|
||
# Register your models here. | ||
@admin.register(Book) | ||
class BookAdmin(admin.ModelAdmin): | ||
list_display = ('title', 'author', 'genre', 'publish_date') # Campos a mostrar en la lista de libros | ||
list_filter = ('genre', 'publish_date') # Filtros por género y fecha de publicación | ||
search_fields = ('title', 'author') # Permite buscar por título y autor | ||
ordering = ('-publish_date',) # Ordenar los libros por la fecha de publicación en orden descendente |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class LibraryConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'library' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django import forms | ||
|
||
from .models import Book | ||
|
||
class BookForm(forms.ModelForm): | ||
class Meta: | ||
model = Book | ||
fields = ['title', 'author', 'description', 'isbn', 'genre', 'publish_date', 'pages', 'cover_image'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 5.1.3 on 2024-12-20 17:03 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Book', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=200)), | ||
('author', models.CharField(max_length=200)), | ||
('description', models.TextField(blank=True, null=True)), | ||
('isbn', models.CharField(blank=True, max_length=13, null=True, unique=True)), | ||
('genre', models.CharField(blank=True, max_length=100, null=True)), | ||
('publish_date', models.DateField(blank=True, null=True)), | ||
('pages', models.PositiveIntegerField(blank=True, null=True)), | ||
('language', models.CharField(blank=True, max_length=50, null=True)), | ||
('cover_image', models.ImageField(blank=True, null=True, upload_to='book_covers/')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class Book(models.Model): | ||
title = models.CharField(max_length=200) # Título del libro (obligatorio) | ||
author = models.CharField(max_length=200) # Autor del libro (obligatorio) | ||
description = models.TextField(blank=True, null=True) # Descripción (opcional) | ||
isbn = models.CharField(max_length=13, unique=True, blank=True, null=True) # ISBN (opcional) | ||
genre = models.CharField(max_length=100, blank=True, null=True) # Género (opcional) | ||
publish_date = models.DateField(null=True, blank=True) # Fecha de publicación (opcional) | ||
pages = models.PositiveIntegerField(blank=True, null=True) # Número de páginas (opcional) | ||
cover_image = models.ImageField(upload_to='book_covers/', blank=True, null=True) # Imagen de la portada (opcional) | ||
created_at = models.DateTimeField(auto_now_add=True) # Fecha de creación | ||
updated_at = models.DateTimeField(auto_now=True) # Fecha de última actualización | ||
|
||
def __str__(self): | ||
return self.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!DOCTYPE html> | ||
<html lang="es"> | ||
<head> | ||
{% load static %} | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>{% block title %}Sitios Visitados{% endblock %}</title> | ||
|
||
<link rel="stylesheet" href="{% static 'css/general.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/gallery/photo_gallery.css' %}"> | ||
<link rel="icon" href="{% static 'images/Lucier.ico' %}" type="image/x-icon"> | ||
|
||
<script src="{% static 'js/gallery/photo_gallery.js' %}" defer></script> | ||
|
||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<header class="header"> | ||
<div class="logo-container"> | ||
<a href="{% url 'core:home_page' %}"> | ||
<img src="{% static 'images/Lucier.png' %}" alt="Logo Lucier" class="logo"> | ||
</a> | ||
</div> | ||
<div class="header-content"> | ||
<h1>Sitios donde hemos estado</h1> | ||
<p>Aquí puedes ver todos los lugares en los que hemos estado y añadir los nuevos a donde vayamos.</p> | ||
</div> | ||
</header> | ||
<div class="header-bar"> | ||
<div class="back-button-container"> | ||
<a href="{% url 'library:library_page' %}" class="btn-back">←</a> | ||
</div> | ||
</div> | ||
<div class="main-container"> | ||
<main class="main-content"> | ||
<div class="details"> | ||
<header class="details-header"> | ||
<div class="action-buttons"> | ||
<a href="{% url 'library:edit_book' book.pk %}" class="btn-edit"><i class="fas fa-pencil-alt"></i></a> | ||
<form action="{% url 'library:delete_book' book.pk %}" method="post" class="btn-delete-form"> | ||
{% csrf_token %} | ||
<button type="submit" class="btn-delete" onclick="return confirm('¿Estás seguro de que deseas eliminar este producto?')"><i class="fas fa-trash-alt"></i></button> | ||
</form> | ||
</div> | ||
<h2>{{ book.title }}</h2> | ||
</header> | ||
|
||
<section class="description"> | ||
<h3>Autor</h3> | ||
<p>{{ book.author }}</p> | ||
</section> | ||
|
||
<section class="item-info"> | ||
<h3>Información adicional</h3> | ||
<ul> | ||
<li><strong>Descripción:</strong> {{ book.description|default:"No disponible" }}</li> | ||
<li><strong>Género:</strong> {{ book.genre|default:"No disponible" }}</li> | ||
<li><strong>ISBN:</strong> {{ book.isbn|default:"No disponible" }}</li> | ||
<li><strong>Fecha de publicación:</strong> {{ book.publish_date|default:"No disponible" }}</li> | ||
<li><strong>Páginas:</strong> {{ book.pages|default:"No disponible" }}</li> | ||
</ul> | ||
</section> | ||
|
||
<section class="item-image"> | ||
<h3>Imagen del libro</h3> | ||
{% if book.cover_image %} | ||
<img src="{{ book.cover_image.url }}" alt="Imagen de {{ book.name }}" class="item-image-preview"> | ||
{% else %} | ||
<p>No se ha cargado imagen.</p> | ||
{% endif %} | ||
</section> | ||
</div> | ||
</main> | ||
</div> | ||
<footer class="footer"> | ||
<p>© 2024 Lucier <span style="color: #C71585;">❤</span></p> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
<html lang="es"> | ||
<head> | ||
{% load static %} | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>{% block title %}Editar viaje{% endblock %}</title> | ||
|
||
<link rel="stylesheet" href="{% static 'css/general.css' %}"> | ||
<link rel="icon" href="{% static 'images/Lucier.ico' %}" type="image/x-icon"> | ||
|
||
<script src="{% static 'js/trips/add_edit_trip.js' %}" defer></script> | ||
</head> | ||
<body> | ||
<header class="header"> | ||
<div class="logo-container"> | ||
<a href="{% url 'core:home_page' %}"> | ||
<img src="{% static 'images/Lucier.png' %}" alt="Logo Lucier" class="logo"> | ||
</a> | ||
</div> | ||
<div class="header-content"> | ||
<h1>Editar viaje a: {{ trip.destiny }}</h1> | ||
</div> | ||
</header> | ||
<div class="header-bar"> | ||
<div class="back-button-container"> | ||
<a href="{% url 'library:book_details_page' book.pk %}" class="btn-back" aria-label="Volver a la lista de sitios">←</a> | ||
</div> | ||
</div> | ||
<div class="main-container"> | ||
<main class="main-content"> | ||
<form method="post" id="dataForm" class="new-form"> | ||
{% csrf_token %} | ||
<div class="form-group"> | ||
<label for="title">Título</label> | ||
<input type="text" id="title" name="title" class="form-control" value="{{ book.title }}" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="author">Autor</label> | ||
<textarea id="description" name="author" class="form-control">{{ book.author }}</textarea> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="isbn">ISBN</label> | ||
<input type="text" id="isbn" name="isbn" class="form-control" value="{{ book.isbn }}" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="cover_image">Imagen</label> | ||
<input type="file" id="cover_image" name="cover_image" class="form-control" accept="image/*" value="{{item.cover_image}}"> | ||
</div> | ||
|
||
<!-- Botón de Envío --> | ||
<button type="submit">Guardar cambios</button> | ||
</form> | ||
</main> | ||
</div> | ||
|
||
<footer class="footer"> | ||
<p>© 2024 Lucier <span style="color: #C71585;">❤</span></p> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE html> | ||
<html lang="es"> | ||
<head> | ||
{% load static %} | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>{% block title %}Sitios Visitados{% endblock %}</title> | ||
|
||
<link rel="stylesheet" href="{% static 'css/general.css' %}"> | ||
<link rel="stylesheet" href="{% static 'css/gallery/photo_gallery.css' %}"> | ||
<link rel="icon" href="{% static 'images/Lucier.ico' %}" type="image/x-icon"> | ||
|
||
<script src="{% static 'js/gallery/photo_gallery.js' %}" defer></script> | ||
|
||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<header class="header"> | ||
<div class="logo-container"> | ||
<a href="{% url 'core:home_page' %}"> | ||
<img src="{% static 'images/Lucier.png' %}" alt="Logo Lucier" class="logo"> | ||
</a> | ||
</div> | ||
<div class="header-content"> | ||
<h1>Sitios donde hemos estado</h1> | ||
<p>Aquí puedes ver todos los lugares en los que hemos estado y añadir los nuevos a donde vayamos.</p> | ||
</div> | ||
</header> | ||
<div class="header-bar"> | ||
<div class="back-button-container"> | ||
<a href="{% url 'core:home_page' %}" class="btn-back" aria-label="Volver a la lista de sitios">←</a> | ||
</div> | ||
<div class="add-buttons-container"> | ||
<div id="add-button-container" class="add-button-container"> | ||
<a href="{% url 'library:new_book' %}" class="btn-add"> | ||
<button type="button">Nuevo libro</button> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="main-container"> | ||
<main class="main-content"> | ||
<div class="books-list"> | ||
<h1 class="category-title">Todos los Libros</h1> | ||
{% if books %} | ||
<ul class="product-list"> | ||
{% for book in books %} | ||
<li class="product-item"> | ||
<a href="{% url 'library:book_details_page' book.pk %}" class="product-link"> | ||
<div class="product-info"> | ||
<h2 class="product-name">{{ book.title }}</h2> | ||
<p class="product-brand">{{ book.author }}</p> | ||
</div> | ||
<span class="product-arrow">→</span> | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<p class="no-items">No hay libros disponibles.</p> | ||
{% endif %} | ||
</div> | ||
</main> | ||
</div> | ||
|
||
<footer class="footer"> | ||
<p>© 2024 Lucier <span style="color: #C71585;">❤</span></p> | ||
</footer> | ||
</body> | ||
</html> |
Oops, something went wrong.