Browse Source

Correcciones para flake8

politica
Celestino Rey 1 year ago
parent
commit
d7a7749bc9
19 changed files with 18 additions and 40 deletions
  1. +1
    -1
      ReyMotaAppsDj/K8S/Makefile
  2. +1
    -1
      ReyMotaAppsDj/K8S/env-prod-configmap.yaml
  3. +2
    -2
      ReyMotaAppsDj/Makefile
  4. +1
    -2
      ReyMotaAppsDj/reymota/libros/forms.py
  5. +1
    -3
      ReyMotaAppsDj/reymota/libros/models.py
  6. +1
    -1
      ReyMotaAppsDj/reymota/libros/urls.py
  7. +0
    -5
      ReyMotaAppsDj/reymota/libros/views.py
  8. +2
    -3
      ReyMotaAppsDj/reymota/lyrics/forms.py
  9. +0
    -2
      ReyMotaAppsDj/reymota/lyrics/models.py
  10. +1
    -1
      ReyMotaAppsDj/reymota/lyrics/urls.py
  11. +0
    -2
      ReyMotaAppsDj/reymota/repostajes/admin.py
  12. +0
    -1
      ReyMotaAppsDj/reymota/repostajes/forms.py
  13. +1
    -10
      ReyMotaAppsDj/reymota/repostajes/models.py
  14. +1
    -1
      ReyMotaAppsDj/reymota/repostajes/urls.py
  15. +2
    -2
      ReyMotaAppsDj/reymota/reymota/settings.py
  16. +1
    -2
      ReyMotaAppsDj/reymota/reymota/urls.py
  17. +1
    -0
      ReyMotaAppsDj/reymota/reymotausers/admin.py
  18. +1
    -0
      ReyMotaAppsDj/reymota/reymotausers/forms.py
  19. +1
    -1
      ReyMotaAppsDj/reymota/reymotausers/models.py

+ 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 = 1.16
export IMG_VERSION = 0.1
export IMG_NGINX_VERSION = 1.0
# limpia todo


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

@ -16,4 +16,4 @@ metadata:
labels:
io.kompose.service: web-env-prod
name: env-prod
namespace: finanzas
namespace: reymota

+ 2
- 2
ReyMotaAppsDj/Makefile View File

@ -2,7 +2,7 @@ install:
echo "Creando imagen con version '${IMG_VERSION}' para la arquitectura '${ARQUITECTURA}' en el registry '${REGISTRY}'"
docker build --no-cache -t ${REGISTRY}/finanzas-${ARQUITECTURA}:${IMG_VERSION} .
docker push ${REGISTRY}/finanzas-${ARQUITECTURA}:${IMG_VERSION}
docker build --no-cache -t ${REGISTRY}/reymota-${ARQUITECTURA}:${IMG_VERSION} .
docker push ${REGISTRY}/reymota-${ARQUITECTURA}:${IMG_VERSION}

+ 1
- 2
ReyMotaAppsDj/reymota/libros/forms.py View File

@ -1,5 +1,4 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import Autor, Libro
@ -28,4 +27,4 @@ class LibroForm(forms.ModelForm):
autor = forms.ModelChoiceField(
queryset=Autor.objects.all(),
widget=forms.Select(attrs={'class': 'form-control'}))
widget=forms.Select(attrs={'class': 'form-control'}))

+ 1
- 3
ReyMotaAppsDj/reymota/libros/models.py View File

@ -1,8 +1,6 @@
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():
@ -31,4 +29,4 @@ class Libro(models.Model):
portada = models.ImageField(upload_to='portadas/', blank=True, null=True) # Nuevo campo
def __str__(self):
return self.titulo
return self.titulo

+ 1
- 1
ReyMotaAppsDj/reymota/libros/urls.py View File

@ -2,7 +2,7 @@ from django.urls import path
from . import views
app_name='libros'
app_name = 'libros'
urlpatterns = [
path('', views.principal, name='principal'),


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

@ -1,10 +1,6 @@
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
@ -105,4 +101,3 @@ def eliminar_libro(request, libro_id):
libro = get_object_or_404(Libro, pk=libro_id)
libro.delete()
return redirect('lista_libros')

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

@ -20,14 +20,13 @@ class AlbumForm(forms.ModelForm):
fields = ['name', 'artist', 'year', 'cover_image']
year = forms.DateField(
widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}))
widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}))
artist = forms.ModelChoiceField(
queryset=Artista.objects.all(),
widget=forms.Select(attrs={'class': 'form-control'}))
class SongForm(forms.ModelForm):
class Meta:
model = Song
@ -41,5 +40,5 @@ class SongForm(forms.ModelForm):
widget=forms.Select(attrs={'class': 'form-control'}))
album = forms.ModelChoiceField(
queryset=Album.objects.all(), # habría que seleccionar los álbumes del artista
queryset=Album.objects.all(), # habría que seleccionar los álbumes del artista
widget=forms.Select(attrs={'class': 'form-control'}))

+ 0
- 2
ReyMotaAppsDj/reymota/lyrics/models.py View File

@ -1,7 +1,6 @@
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():
@ -41,4 +40,3 @@ class Song(models.Model):
def __str__(self):
return self.title

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

@ -3,7 +3,7 @@ from django.urls import path
from . import views
app_name='lyrics'
app_name = 'lyrics'
urlpatterns = [
path('', views.principal, name='principal'),


+ 0
- 2
ReyMotaAppsDj/reymota/repostajes/admin.py View File

@ -7,5 +7,3 @@ from .models import Vehiculo, Repostaje
admin.site.register(Vehiculo)
admin.site.register(Repostaje)

+ 0
- 1
ReyMotaAppsDj/reymota/repostajes/forms.py View File

@ -39,4 +39,3 @@ class RepostajeForm(forms.ModelForm):
widget=forms.NumberInput(attrs={'class': 'form-control'}))
aplica_descuento = forms.BooleanField(initial=False, required=False)

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

@ -1,14 +1,5 @@
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)
from django.core.validators import MaxValueValidator
class Vehiculo(models.Model):


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

@ -2,7 +2,7 @@ from django.urls import path
from . import views
app_name='repostajes'
app_name = 'repostajes'
urlpatterns = [
path('', views.principal, name='principal'),


+ 2
- 2
ReyMotaAppsDj/reymota/reymota/settings.py View File

@ -11,7 +11,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -60,7 +60,7 @@ ROOT_URLCONF = 'reymota.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ BASE_DIR / 'templates' ],
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [


+ 1
- 2
ReyMotaAppsDj/reymota/reymota/urls.py View File

@ -22,7 +22,7 @@ from django.views.generic.base import TemplateView # new
urlpatterns = [
path('obreros/', admin.site.urls),
path('libros/', include('libros.urls')),
path('repostajes/', include('repostajes.urls')),
@ -36,4 +36,3 @@ urlpatterns = [
path("", TemplateView.as_view(template_name="index.html"),
name="principal"), # new
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

+ 1
- 0
ReyMotaAppsDj/reymota/reymotausers/admin.py View File

@ -7,6 +7,7 @@ from django.contrib.auth.admin import UserAdmin
from reymotausers.models import ReyMotaUser
from reymotausers.forms import ReyMotaUserCreationForm, ReyMotaUserChangeForm
class ReyMotaUserAdmin(UserAdmin):
add_form = ReyMotaUserCreationForm
form = ReyMotaUserChangeForm


+ 1
- 0
ReyMotaAppsDj/reymota/reymotausers/forms.py View File

@ -3,6 +3,7 @@ from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import ReyMotaUser
class ReyMotaUserCreationForm(UserCreationForm):
class Meta:


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

@ -7,6 +7,7 @@ from .managers import ReyMotaUserManager
# Create your models here.
class ReyMotaUser(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(_("email address"), unique=True)
foto = models.ImageField(upload_to="profile_images", default="profile_images/default.jpg", blank=True)
@ -21,4 +22,3 @@ class ReyMotaUser(AbstractBaseUser, PermissionsMixin):
def __str__(self):
return self.email

Loading…
Cancel
Save