From 1c7cc527871795b6e850e0a65d1159fc75c18edc Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Tue, 10 Sep 2024 11:00:24 +0200 Subject: [PATCH] Borro copias de ficheros (creadas por alguno de los editores) --- ReyMotaAppsDj/reymota/libros/forms.py~ | 46 ------ ReyMotaAppsDj/reymota/libros/models.py~ | 35 ----- ReyMotaAppsDj/reymota/libros/urls.py~ | 20 --- ReyMotaAppsDj/reymota/libros/views.py~ | 113 -------------- ReyMotaAppsDj/reymota/repostajes/urls.py~ | 19 --- ReyMotaAppsDj/reymota/reymota/settings.py~ | 146 ------------------ ReyMotaAppsDj/reymota/reymota/urls.py~ | 37 ----- .../reymota/templates/_cabecera.html~ | 121 --------------- ReyMotaAppsDj/reymota/templates/_head.html~ | 23 --- .../reymota/templates/libros/index.html~ | 55 ------- .../templates/libros/lista_autores.html~ | 71 --------- .../templates/libros/lista_libros.html~ | 72 --------- 12 files changed, 758 deletions(-) delete mode 100644 ReyMotaAppsDj/reymota/libros/forms.py~ delete mode 100644 ReyMotaAppsDj/reymota/libros/models.py~ delete mode 100644 ReyMotaAppsDj/reymota/libros/urls.py~ delete mode 100644 ReyMotaAppsDj/reymota/libros/views.py~ delete mode 100644 ReyMotaAppsDj/reymota/repostajes/urls.py~ delete mode 100644 ReyMotaAppsDj/reymota/reymota/settings.py~ delete mode 100644 ReyMotaAppsDj/reymota/reymota/urls.py~ delete mode 100644 ReyMotaAppsDj/reymota/templates/_cabecera.html~ delete mode 100644 ReyMotaAppsDj/reymota/templates/_head.html~ delete mode 100644 ReyMotaAppsDj/reymota/templates/libros/index.html~ delete mode 100644 ReyMotaAppsDj/reymota/templates/libros/lista_autores.html~ delete mode 100644 ReyMotaAppsDj/reymota/templates/libros/lista_libros.html~ diff --git a/ReyMotaAppsDj/reymota/libros/forms.py~ b/ReyMotaAppsDj/reymota/libros/forms.py~ deleted file mode 100644 index 33e0f5c..0000000 --- a/ReyMotaAppsDj/reymota/libros/forms.py~ +++ /dev/null @@ -1,46 +0,0 @@ -from django import forms -from django.contrib.auth.forms import UserCreationForm, UserChangeForm - -from .models import Autor, Libro - - -class AutorForm(forms.ModelForm): - class Meta: - model = Autor - fields = ['nombre', 'biografia', 'foto'] - - nombre = forms.CharField( - widget=forms.TextInput(attrs={'class': 'form-control'})) - biografia = forms.CharField( - widget=forms.TextInput(attrs={'class': 'form-control'})) - - -class LibroForm(forms.ModelForm): - class Meta: - model = Libro - fields = ['titulo', 'autor', 'fecha_publicacion', 'descripcion', - 'archivo', 'portada'] - - titulo = forms.CharField( - widget=forms.TextInput(attrs={'class': 'form-control'})) - descripcion = forms.CharField( - widget=forms.TextInput(attrs={'class': 'form-control'})) - - autor = forms.ModelChoiceField( - queryset=Autor.objects.all(), - widget=forms.Select(attrs={'class': 'form-control'})) - - -class ReyMotaUserCreationForm(UserCreationForm): - - class Meta: - model = ReyMotaUser - fields = ("email", "nombre", "foto") - labels = {'email': 'Dirección de correo'} - - -class ReyMotaUserChangeForm(UserChangeForm): - - class Meta: - model = ReyMotaUser - fields = ("email", "foto") diff --git a/ReyMotaAppsDj/reymota/libros/models.py~ b/ReyMotaAppsDj/reymota/libros/models.py~ deleted file mode 100644 index 687db45..0000000 --- a/ReyMotaAppsDj/reymota/libros/models.py~ +++ /dev/null @@ -1,35 +0,0 @@ -from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin -from django.db import models -import datetime -from django.core.validators import MaxValueValidator, MinValueValidator -from django.utils.translation import gettext_lazy as _ - - -def current_year(): - return datetime.date.today().year - - -def max_value_current_year(value): - return MaxValueValidator(current_year())(value) - - -class Autor(models.Model): - nombre = models.CharField(max_length=200) - biografia = models.TextField(blank=True, null=True) - foto = models.ImageField(upload_to='autores/', blank=True, null=True) # Nuevo campo - - def __str__(self): - return self.nombre - - -class Libro(models.Model): - titulo = models.CharField(max_length=200) - autor = models.ForeignKey(Autor, on_delete=models.CASCADE) - fecha_publicacion = models.PositiveBigIntegerField(default=current_year(), validators=[MinValueValidator(1984), max_value_current_year]) - descripcion = models.TextField(blank=True, null=True) - archivo = models.FileField(upload_to='libros/') - portada = models.ImageField(upload_to='portadas/', blank=True, null=True) # Nuevo campo - - def __str__(self): - return self.titulo - diff --git a/ReyMotaAppsDj/reymota/libros/urls.py~ b/ReyMotaAppsDj/reymota/libros/urls.py~ deleted file mode 100644 index e0f1710..0000000 --- a/ReyMotaAppsDj/reymota/libros/urls.py~ +++ /dev/null @@ -1,20 +0,0 @@ -from django.urls import path - -from . import views - -app_name='libros' - -urlpatterns = [ - path('autores/', views.lista_autores, name='lista_autores'), - path('autores/nuevo/', views.nuevo_autor, name='nuevo_autor'), - path('autores//', views.detalle_autor, name='detalle_autor'), - path('autores//editar/', views.editar_autor, name='editar_autor'), - path('autores//eliminar/', views.eliminar_autor, name='eliminar_autor'), - - path('libros/', views.lista_libros, name='lista_libros'), - path('libros/nuevo/', views.nuevo_libro, name='nuevo_libro'), - path('libros//', views.detalle_libro, name='detalle_libro'), - path('libros//editar/', views.editar_libro, name='editar_libro'), - path('libros//eliminar/', views.eliminar_libro, name='eliminar_libro'), - -] diff --git a/ReyMotaAppsDj/reymota/libros/views.py~ b/ReyMotaAppsDj/reymota/libros/views.py~ deleted file mode 100644 index a938d36..0000000 --- a/ReyMotaAppsDj/reymota/libros/views.py~ +++ /dev/null @@ -1,113 +0,0 @@ -from django.shortcuts import render, get_object_or_404, redirect -from django.contrib.auth.decorators import login_required - -from django.views.generic import CreateView -from django.contrib.auth.forms import UserCreationForm -from django.urls import reverse_lazy - -from .models import Autor, Libro -from .forms import AutorForm, LibroForm - - -@login_required -def principal(request): - return render(request, 'gestion/index.html') - - -# Vistas para los autores -@login_required -def lista_autores(request): - autores = Autor.objects.all() - return render(request, 'gestion/lista_autores.html', {'autores': autores}) - - -@login_required -def detalle_autor(request, autor_id): - autor = get_object_or_404(Autor, pk=autor_id) - - libros = Libro.objects.filter(autor=autor_id) - - return render(request, 'gestion/detalle_autor.html', {'autor': autor, 'libros': libros}) - - -@login_required -def nuevo_autor(request): - if request.method == 'POST': - form = AutorForm(request.POST, request.FILES) - if form.is_valid(): - form.save() - return redirect('lista_autores') - else: - form = AutorForm() - return render(request, 'gestion/form_autor.html', {'form': form}) - - -@login_required -def editar_autor(request, autor_id): - autor = get_object_or_404(Autor, pk=autor_id) - if request.method == 'POST': - form = AutorForm(request.POST, request.FILES, instance=autor) - if form.is_valid(): - form.save() - return redirect('lista_autores') - else: - form = AutorForm(instance=autor) - return render(request, 'gestion/form_autor.html', {'form': form}) - - -@login_required -def eliminar_autor(request, autor_id): - autor = get_object_or_404(Autor, pk=autor_id) - autor.delete() - return redirect('lista_autores') - - -# Vistas para los libros -@login_required -def lista_libros(request): - libros = Libro.objects.all() - return render(request, 'gestion/lista_libros.html', {'libros': libros}) - - -@login_required -def detalle_libro(request, libro_id): - libro = get_object_or_404(Libro, pk=libro_id) - return render(request, 'gestion/detalle_libro.html', {'libro': libro}) - - -@login_required -def nuevo_libro(request): - if request.method == 'POST': - form = LibroForm(request.POST, request.FILES) - if form.is_valid(): - form.save() - return redirect('lista_libros') - else: - form = LibroForm() - return render(request, 'gestion/form_libro.html', {'form': form}) - - -@login_required -def editar_libro(request, libro_id): - libro = get_object_or_404(Libro, pk=libro_id) - if request.method == 'POST': - form = LibroForm(request.POST, request.FILES, instance=libro) - if form.is_valid(): - form.save() - return redirect('lista_libros') - else: - form = LibroForm(instance=libro) - return render(request, 'gestion/form_libro.html', {'form': form}) - - -@login_required -def eliminar_libro(request, libro_id): - libro = get_object_or_404(Libro, pk=libro_id) - libro.delete() - return redirect('lista_libros') - - -class SignUpView(CreateView): - form_class = UserCreationForm - success_url = reverse_lazy("login") - template_name = "registration/signup.html" diff --git a/ReyMotaAppsDj/reymota/repostajes/urls.py~ b/ReyMotaAppsDj/reymota/repostajes/urls.py~ deleted file mode 100644 index 10b6d11..0000000 --- a/ReyMotaAppsDj/reymota/repostajes/urls.py~ +++ /dev/null @@ -1,19 +0,0 @@ -from django.urls import path - -from . import views - -app_name='repostajes' - -urlpatterns = [ - path('vehiculos/', views.lista_vehiculos, name='lista_vehiculos'), - path('vehiculos/nuevo/', views.nuevo_vehiculo, name='nuevo_vehiculo'), - path('vehiculos//', views.detalle_vehiculo, name='detalle_vehiculo'), - path('vehiculos//editar/', views.editar_vehiculo, name='editar_vehiculo'), - path('vehiculos//eliminar/', views.eliminar_vehiculo, name='eliminar_vehiculo'), - - path('repostajes/', views.lista_repostajes, name='lista_repostajes'), - path('repostajes/nuevo/', views.nuevo_repostaje, name='nuevo_repostaje'), - path('repostajes//', views.detalle_repostaje, name='detalle_repostaje'), - path('repostajes//editar/', views.editar_repostaje, name='editar_repostaje'), - path('repostajes//eliminar/', views.eliminar_repostaje, name='eliminar_repostaje'), -] diff --git a/ReyMotaAppsDj/reymota/reymota/settings.py~ b/ReyMotaAppsDj/reymota/reymota/settings.py~ deleted file mode 100644 index cd76b85..0000000 --- a/ReyMotaAppsDj/reymota/reymota/settings.py~ +++ /dev/null @@ -1,146 +0,0 @@ -""" -Django settings for reymota project. - -Generated by 'django-admin startproject' using Django 5.1. - -For more information on this file, see -https://docs.djangoproject.com/en/5.1/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/5.1/ref/settings/ -""" - -from pathlib import Path - - -# Build paths inside the project like this: BASE_DIR / 'subdir'. -BASE_DIR = Path(__file__).resolve().parent.parent - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -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 - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - - 'repostajes', - 'reymotausers', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = 'reymota.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ BASE_DIR / 'templates' ], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - 'libraries': { - 'filtros_de_entorno': 'reymota.templatetags.filtros_de_entorno', - } - }, - }, -] - -WSGI_APPLICATION = 'reymota.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/5.1/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } -} - - -# Password validation -# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/5.1/topics/i18n/ - -LANGUAGE_CODE = 'es-es' - -TIME_ZONE = 'Europe/Madrid' - -USE_I18N = True - -USE_TZ = True -I18N = True -L10N = True -DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '.' - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/5.1/howto/static-files/ - -STATIC_URL = '/static/' -STATIC_ROOT = BASE_DIR / "staticfiles" - -# Default primary key field type -# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field - -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' - -LOGIN_URL = '/accounts/login/' -LOGIN_REDIRECT_URL = 'principal' -LOGOUT_REDIRECT_URL = 'principal' - -AUTH_USER_MODEL = "reymotausers.ReyMotaUser" - -MEDIA_ROOT = BASE_DIR / "mediafiles" -MEDIA_URL = '/media/' - -if DEBUG is False: - CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ") diff --git a/ReyMotaAppsDj/reymota/reymota/urls.py~ b/ReyMotaAppsDj/reymota/reymota/urls.py~ deleted file mode 100644 index 7bde37e..0000000 --- a/ReyMotaAppsDj/reymota/reymota/urls.py~ +++ /dev/null @@ -1,37 +0,0 @@ -""" -URL configuration for reymota project. - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/5.1/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" -from django.contrib import admin -from django.urls import path, include -from django.conf.urls.static import static -from django.conf import settings -from django.views.generic.base import TemplateView # new - -urlpatterns = [ - path('obreros/', admin.site.urls), - -# path('apuntes/', include('apuntes.urls')), - - path('repostajes/', include('repostajes.urls')), - - path("accounts/", include("accounts.urls")), # new - - path("accounts/", include("django.contrib.auth.urls")), - - path("", TemplateView.as_view(template_name="apuntes/index.html"), - name="principal"), # new -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) - diff --git a/ReyMotaAppsDj/reymota/templates/_cabecera.html~ b/ReyMotaAppsDj/reymota/templates/_cabecera.html~ deleted file mode 100644 index e7d5e74..0000000 --- a/ReyMotaAppsDj/reymota/templates/_cabecera.html~ +++ /dev/null @@ -1,121 +0,0 @@ -{% load static %} - -
-
-
-
-
- - - -
- - - - -
- -
-
-
-
- -
-
-
- × - - {% include "_branding.html" %} - - -
-
- -
diff --git a/ReyMotaAppsDj/reymota/templates/_head.html~ b/ReyMotaAppsDj/reymota/templates/_head.html~ deleted file mode 100644 index 894a01f..0000000 --- a/ReyMotaAppsDj/reymota/templates/_head.html~ +++ /dev/null @@ -1,23 +0,0 @@ -{% load static %} - - - - - Aplicaciones en Reymota.es - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ReyMotaAppsDj/reymota/templates/libros/index.html~ b/ReyMotaAppsDj/reymota/templates/libros/index.html~ deleted file mode 100644 index c4ac661..0000000 --- a/ReyMotaAppsDj/reymota/templates/libros/index.html~ +++ /dev/null @@ -1,55 +0,0 @@ -{% extends 'base.html' %} - -{% block content %} - -
- -

Introducción

- - -
-
-
-
-

Vehículos

-
$12,628
-
- - - 20%
-
- -
-
- -
-
-
-

Repostajes

-
$2,250
-
- - - 5%
-
- -
-
-
-
- -{% endblock %} diff --git a/ReyMotaAppsDj/reymota/templates/libros/lista_autores.html~ b/ReyMotaAppsDj/reymota/templates/libros/lista_autores.html~ deleted file mode 100644 index 3db4c28..0000000 --- a/ReyMotaAppsDj/reymota/templates/libros/lista_autores.html~ +++ /dev/null @@ -1,71 +0,0 @@ -{% extends 'base.html' %} - -{% block content %} -
- -
-
-

Autores

-
-
-
-
-
- -
-
-
- -
- {% for autor in autores %} -
-
-
- - {% if autor.foto %} - Foto del autor - {% else %} - Sin imágen - {% endif %} -

{{ autor.nombre}}

- -
- -
- -
-
-
- {% endfor %} -
-
-{% endblock %} \ No newline at end of file diff --git a/ReyMotaAppsDj/reymota/templates/libros/lista_libros.html~ b/ReyMotaAppsDj/reymota/templates/libros/lista_libros.html~ deleted file mode 100644 index 2e15d52..0000000 --- a/ReyMotaAppsDj/reymota/templates/libros/lista_libros.html~ +++ /dev/null @@ -1,72 +0,0 @@ - -{% extends 'base.html' %} - -{% block content %} -
- -
-
-

Libros

-
-
-
-
-
- -
-
-
- -
- {% for libro in libros %} -
-
-
- {% if libro.portada %} - {{ libro.titulo }}, - {% else %} - Sin imágen - {% endif %} -

{{ libro.titulo }}

-
- -
- -
- -
- -
-
-
- {% endfor %} -
-
-{% endblock %}