From a77dc22153afef7514119e8da42356755896c15b Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 21 Feb 2025 09:58:05 +0100 Subject: [PATCH] Arreglos en paths a media --- JugarAlPadel/K8S/Makefile | 2 +- .../gestion_reservas/reymotausers/serializers.py | 8 ++++++++ ReyMotaAppsDj/K8S/Makefile | 2 +- ReyMotaAppsDj/reymota/repostajes/serializers.py | 8 ++++++++ ReyMotaAppsDj/reymota/reymotausers/serializers.py | 10 +++++++++- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/JugarAlPadel/K8S/Makefile b/JugarAlPadel/K8S/Makefile index ffaeba3..d56662a 100644 --- a/JugarAlPadel/K8S/Makefile +++ b/JugarAlPadel/K8S/Makefile @@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') #export REGISTRY=localhost:5000 export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.61 +export IMG_VERSION = 0.62 export IMG_NGINX_VERSION = 2.3 # limpia todo diff --git a/JugarAlPadel/gestion_reservas/reymotausers/serializers.py b/JugarAlPadel/gestion_reservas/reymotausers/serializers.py index dca3e4b..617baf1 100644 --- a/JugarAlPadel/gestion_reservas/reymotausers/serializers.py +++ b/JugarAlPadel/gestion_reservas/reymotausers/serializers.py @@ -1,3 +1,5 @@ +import os + from rest_framework import serializers from .models import ReyMotaUser @@ -6,3 +8,9 @@ class ReyMotaUserSerializer(serializers.ModelSerializer): class Meta: model = ReyMotaUser fields = ['email', 'password', 'foto', 'is_superuser', 'is_staff', 'is_active', 'nombre', 'last_login'] + + def to_representation(self, instance): + ret = super().to_representation(instance) + ret['foto'] = "profile_images/" + os.path.basename(ret['foto']) + + return ret diff --git a/ReyMotaAppsDj/K8S/Makefile b/ReyMotaAppsDj/K8S/Makefile index 023878c..abc1859 100644 --- a/ReyMotaAppsDj/K8S/Makefile +++ b/ReyMotaAppsDj/K8S/Makefile @@ -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.54 +export IMG_VERSION = 0.55 export IMG_NGINX_VERSION = 1.0 # limpia todo diff --git a/ReyMotaAppsDj/reymota/repostajes/serializers.py b/ReyMotaAppsDj/reymota/repostajes/serializers.py index f3583e4..cb452bc 100644 --- a/ReyMotaAppsDj/reymota/repostajes/serializers.py +++ b/ReyMotaAppsDj/reymota/repostajes/serializers.py @@ -1,3 +1,5 @@ +import os + from rest_framework import serializers from .models import Vehiculo, Repostaje @@ -7,6 +9,12 @@ class VehiculoSerializer(serializers.ModelSerializer): model = Vehiculo fields = '__all__' # Incluir todos los campos del modelo + def to_representation(self, instance): + ret = super().to_representation(instance) + ret['foto'] = "vehiculos/" + os.path.basename(ret['foto']) + + return ret + class RepostajeSerializer(serializers.ModelSerializer): vehiculo_matricula = serializers.CharField(source='vehiculo.matricula', read_only=True) diff --git a/ReyMotaAppsDj/reymota/reymotausers/serializers.py b/ReyMotaAppsDj/reymota/reymotausers/serializers.py index 5b9c965..617baf1 100644 --- a/ReyMotaAppsDj/reymota/reymotausers/serializers.py +++ b/ReyMotaAppsDj/reymota/reymotausers/serializers.py @@ -1,3 +1,5 @@ +import os + from rest_framework import serializers from .models import ReyMotaUser @@ -5,4 +7,10 @@ from .models import ReyMotaUser class ReyMotaUserSerializer(serializers.ModelSerializer): class Meta: model = ReyMotaUser - fields = '__all__' # Incluir todos los campos del modelo + fields = ['email', 'password', 'foto', 'is_superuser', 'is_staff', 'is_active', 'nombre', 'last_login'] + + def to_representation(self, instance): + ret = super().to_representation(instance) + ret['foto'] = "profile_images/" + os.path.basename(ret['foto']) + + return ret