forked from TDTP/admin_transporte_backend
Compare commits
No commits in common. "master" and "develop/Ronald" have entirely different histories.
master
...
develop/Ro
|
@ -20,6 +20,8 @@ DB_MONGO_PASS=password
|
||||||
SMTP_HOST=smtp-mail.outlook.com
|
SMTP_HOST=smtp-mail.outlook.com
|
||||||
SMTP_PORT=587
|
SMTP_PORT=587
|
||||||
SMTP_PROTOCOL=tls
|
SMTP_PROTOCOL=tls
|
||||||
|
SMTP_USER=francisco.sandoval@outlook.cl
|
||||||
|
SMTP_PASS=aigdvnrbueitklry
|
||||||
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
||||||
|
|
||||||
# PATH UPLOAD
|
# PATH UPLOAD
|
||||||
|
|
|
@ -14,6 +14,8 @@ DB_REDIS_PORT=6379
|
||||||
SMTP_HOST=smtp-mail.outlook.com
|
SMTP_HOST=smtp-mail.outlook.com
|
||||||
SMTP_PORT=587
|
SMTP_PORT=587
|
||||||
SMTP_PROTOCOL=tls
|
SMTP_PROTOCOL=tls
|
||||||
|
SMTP_USER=francisco.sandoval@outlook.cl
|
||||||
|
SMTP_PASS=aigdvnrbueitklry
|
||||||
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
||||||
|
|
||||||
# PATH UPLOAD
|
# PATH UPLOAD
|
||||||
|
|
|
@ -103,6 +103,16 @@ if v_error = '' THEN
|
||||||
end
|
end
|
||||||
WHERE trip_headsign LIKE '%-%-%';
|
WHERE trip_headsign LIKE '%-%-%';
|
||||||
|
|
||||||
|
update z_routes
|
||||||
|
set route_long_name = replace (route_long_name,replace(
|
||||||
|
(select distinct trip_headsign from z_trips where route_id =z_routes.route_id and trip_headsign like '%~%' ),'~','-'
|
||||||
|
),
|
||||||
|
(select distinct trip_headsign from z_trips where route_id =z_routes.route_id and trip_headsign like '%~%' )
|
||||||
|
)
|
||||||
|
WHERE route_long_name LIKE '%-%-%-%-%';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update gtfs_archivo
|
update gtfs_archivo
|
||||||
set vigente = False
|
set vigente = False
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ApiMiddleware:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
match = resolve(request.path)
|
match = resolve(request.path)
|
||||||
logging.info(match)
|
logging.error(match)
|
||||||
|
|
||||||
# se omite esta regla al mostrar imagen de paradero
|
# se omite esta regla al mostrar imagen de paradero
|
||||||
if match.url_name == 'paradero_imagen-detail' and request.method == 'GET':
|
if match.url_name == 'paradero_imagen-detail' and request.method == 'GET':
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from .validaciones import rut_valido
|
from .validaciones import rut_valido
|
||||||
|
|
||||||
|
|
||||||
class Aplicacion(models.Model):
|
class Aplicacion(models.Model):
|
||||||
id_aplicacion = models.IntegerField(primary_key=True)
|
id_aplicacion = models.IntegerField(primary_key=True)
|
||||||
nombre_app = models.CharField(max_length=100, blank=False, null=False)
|
nombre_app = models.CharField(max_length=100, blank=False, null=False)
|
||||||
|
@ -18,6 +19,7 @@ class Aplicacion(models.Model):
|
||||||
managed = True
|
managed = True
|
||||||
db_table = 'aplicacion'
|
db_table = 'aplicacion'
|
||||||
|
|
||||||
|
|
||||||
class Comuna(models.Model):
|
class Comuna(models.Model):
|
||||||
id_comuna = models.IntegerField(primary_key=True)
|
id_comuna = models.IntegerField(primary_key=True)
|
||||||
id_region = models.ForeignKey('Region', models.DO_NOTHING, db_column='id_region', blank=True, null=True)
|
id_region = models.ForeignKey('Region', models.DO_NOTHING, db_column='id_region', blank=True, null=True)
|
||||||
|
@ -27,6 +29,7 @@ class Comuna(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'comuna'
|
db_table = 'comuna'
|
||||||
|
|
||||||
|
|
||||||
class Conductor(models.Model):
|
class Conductor(models.Model):
|
||||||
patente = models.OneToOneField('Vehiculo', models.DO_NOTHING, db_column='patente', primary_key=True)
|
patente = models.OneToOneField('Vehiculo', models.DO_NOTHING, db_column='patente', primary_key=True)
|
||||||
rut = models.ForeignKey('Persona', models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
rut = models.ForeignKey('Persona', models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
||||||
|
@ -36,6 +39,7 @@ class Conductor(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'conductor'
|
db_table = 'conductor'
|
||||||
|
|
||||||
|
|
||||||
class Dispositivo(models.Model):
|
class Dispositivo(models.Model):
|
||||||
id_dispositivo = models.CharField(primary_key=True, max_length=100)
|
id_dispositivo = models.CharField(primary_key=True, max_length=100)
|
||||||
id_paradero = models.ForeignKey('Paradero', models.DO_NOTHING, db_column='id_paradero', blank=False, null=False)
|
id_paradero = models.ForeignKey('Paradero', models.DO_NOTHING, db_column='id_paradero', blank=False, null=False)
|
||||||
|
@ -47,6 +51,7 @@ class Dispositivo(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'dispositivo'
|
db_table = 'dispositivo'
|
||||||
|
|
||||||
|
|
||||||
class GtfsFrequencie(models.Model):
|
class GtfsFrequencie(models.Model):
|
||||||
id_trip = models.ForeignKey('GtfsTrips', models.DO_NOTHING, db_column='id_trip', blank=True, null=True)
|
id_trip = models.ForeignKey('GtfsTrips', models.DO_NOTHING, db_column='id_trip', blank=True, null=True)
|
||||||
start_time = models.TimeField(blank=True, null=True)
|
start_time = models.TimeField(blank=True, null=True)
|
||||||
|
@ -58,6 +63,7 @@ class GtfsFrequencie(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'gtfs_frequencie'
|
db_table = 'gtfs_frequencie'
|
||||||
|
|
||||||
|
|
||||||
class GtfsPosiciones(models.Model):
|
class GtfsPosiciones(models.Model):
|
||||||
id = models.UUIDField(primary_key=True)
|
id = models.UUIDField(primary_key=True)
|
||||||
trip_id = models.UUIDField()
|
trip_id = models.UUIDField()
|
||||||
|
@ -171,6 +177,7 @@ class Linea(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'linea'
|
db_table = 'linea'
|
||||||
|
|
||||||
|
|
||||||
class LineaParadero(models.Model):
|
class LineaParadero(models.Model):
|
||||||
id_linea_paradero = models.AutoField(primary_key=True)
|
id_linea_paradero = models.AutoField(primary_key=True)
|
||||||
id_linea = models.ForeignKey(Linea, models.DO_NOTHING, db_column='id_linea')
|
id_linea = models.ForeignKey(Linea, models.DO_NOTHING, db_column='id_linea')
|
||||||
|
@ -180,6 +187,7 @@ class LineaParadero(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'linea_paradero'
|
db_table = 'linea_paradero'
|
||||||
|
|
||||||
|
|
||||||
class Rol(models.Model):
|
class Rol(models.Model):
|
||||||
id_rol = models.IntegerField(primary_key=True)
|
id_rol = models.IntegerField(primary_key=True)
|
||||||
nombre_rol = models.CharField(max_length=100)
|
nombre_rol = models.CharField(max_length=100)
|
||||||
|
@ -188,6 +196,7 @@ class Rol(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'rol'
|
db_table = 'rol'
|
||||||
|
|
||||||
|
|
||||||
class Operador(models.Model):
|
class Operador(models.Model):
|
||||||
id_operador = models.CharField(primary_key=True, max_length=150)
|
id_operador = models.CharField(primary_key=True, max_length=150)
|
||||||
id_region = models.ForeignKey('Region', models.DO_NOTHING, db_column='id_region', blank=True, null=True)
|
id_region = models.ForeignKey('Region', models.DO_NOTHING, db_column='id_region', blank=True, null=True)
|
||||||
|
@ -204,6 +213,7 @@ class Operador(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'operador'
|
db_table = 'operador'
|
||||||
|
|
||||||
|
|
||||||
class Paradero(models.Model):
|
class Paradero(models.Model):
|
||||||
id_paradero = models.CharField(primary_key=True, max_length=50)
|
id_paradero = models.CharField(primary_key=True, max_length=50)
|
||||||
id_comuna = models.ForeignKey(Comuna, models.DO_NOTHING, db_column='id_comuna', blank=True, null=True)
|
id_comuna = models.ForeignKey(Comuna, models.DO_NOTHING, db_column='id_comuna', blank=True, null=True)
|
||||||
|
@ -225,6 +235,7 @@ class Paradero(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'paradero'
|
db_table = 'paradero'
|
||||||
|
|
||||||
|
|
||||||
class ParaderoImagen(models.Model):
|
class ParaderoImagen(models.Model):
|
||||||
id_paradero_imagen = models.AutoField(primary_key=True)
|
id_paradero_imagen = models.AutoField(primary_key=True)
|
||||||
id_paradero = models.ForeignKey(Paradero, models.DO_NOTHING, db_column='id_paradero')
|
id_paradero = models.ForeignKey(Paradero, models.DO_NOTHING, db_column='id_paradero')
|
||||||
|
@ -235,6 +246,7 @@ class ParaderoImagen(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'paradero_imagen'
|
db_table = 'paradero_imagen'
|
||||||
|
|
||||||
|
|
||||||
class Persona(models.Model):
|
class Persona(models.Model):
|
||||||
rut = models.DecimalField(primary_key=True, max_digits=12, decimal_places=0)
|
rut = models.DecimalField(primary_key=True, max_digits=12, decimal_places=0)
|
||||||
id_tipo_tratamiento = models.ForeignKey('TipoTratamientoPersona', models.DO_NOTHING, db_column='id_tipo_tratamiento', blank=True, null=True)
|
id_tipo_tratamiento = models.ForeignKey('TipoTratamientoPersona', models.DO_NOTHING, db_column='id_tipo_tratamiento', blank=True, null=True)
|
||||||
|
@ -261,6 +273,7 @@ class Persona(models.Model):
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Region(models.Model):
|
class Region(models.Model):
|
||||||
id_region = models.IntegerField(primary_key=True)
|
id_region = models.IntegerField(primary_key=True)
|
||||||
nombre_region = models.CharField(max_length=100)
|
nombre_region = models.CharField(max_length=100)
|
||||||
|
@ -269,6 +282,9 @@ class Region(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'region'
|
db_table = 'region'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RolAplicacion(models.Model):
|
class RolAplicacion(models.Model):
|
||||||
id_rol_app = models.AutoField(primary_key=True)
|
id_rol_app = models.AutoField(primary_key=True)
|
||||||
id_aplicacion = models.ForeignKey(Aplicacion, models.DO_NOTHING, db_column='id_aplicacion', blank=False, null=False)
|
id_aplicacion = models.ForeignKey(Aplicacion, models.DO_NOTHING, db_column='id_aplicacion', blank=False, null=False)
|
||||||
|
@ -285,6 +301,7 @@ class RolOperador(models.Model):
|
||||||
id_rol = models.ForeignKey(Rol, models.DO_NOTHING, db_column='id_rol')
|
id_rol = models.ForeignKey(Rol, models.DO_NOTHING, db_column='id_rol')
|
||||||
id_operador = models.ForeignKey(Operador, on_delete=models.CASCADE, db_column='id_operador')
|
id_operador = models.ForeignKey(Operador, on_delete=models.CASCADE, db_column='id_operador')
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = True
|
managed = True
|
||||||
db_table = 'rol_operador'
|
db_table = 'rol_operador'
|
||||||
|
@ -310,6 +327,7 @@ class TipoDispositivo(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'tipo_dispositivo'
|
db_table = 'tipo_dispositivo'
|
||||||
|
|
||||||
|
|
||||||
class TipoParadero(models.Model):
|
class TipoParadero(models.Model):
|
||||||
id_tipo_paradero = models.IntegerField(primary_key=True)
|
id_tipo_paradero = models.IntegerField(primary_key=True)
|
||||||
descripcion = models.CharField(max_length=100, blank=True, null=True)
|
descripcion = models.CharField(max_length=100, blank=True, null=True)
|
||||||
|
@ -318,6 +336,7 @@ class TipoParadero(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'tipo_paradero'
|
db_table = 'tipo_paradero'
|
||||||
|
|
||||||
|
|
||||||
class TipoTransporte(models.Model):
|
class TipoTransporte(models.Model):
|
||||||
id_tipo_transporte = models.IntegerField(primary_key=True)
|
id_tipo_transporte = models.IntegerField(primary_key=True)
|
||||||
descripcion = models.CharField(max_length=50, blank=True, null=True)
|
descripcion = models.CharField(max_length=50, blank=True, null=True)
|
||||||
|
@ -344,6 +363,7 @@ class TipoTratamientoPersona(models.Model):
|
||||||
db_table = 'tipo_tratamiento_persona'
|
db_table = 'tipo_tratamiento_persona'
|
||||||
db_table_comment = 'Establece el tratamiento de como dirigirse hacia una persona:\r\nEjemplo\r\nSeñor\r\nSeñora\r\nSrta'
|
db_table_comment = 'Establece el tratamiento de como dirigirse hacia una persona:\r\nEjemplo\r\nSeñor\r\nSeñora\r\nSrta'
|
||||||
|
|
||||||
|
|
||||||
class TipoVehiculo(models.Model):
|
class TipoVehiculo(models.Model):
|
||||||
id_tipo_vehiculo = models.IntegerField(primary_key=True)
|
id_tipo_vehiculo = models.IntegerField(primary_key=True)
|
||||||
descripcion = models.CharField(max_length=100, blank=True, null=True)
|
descripcion = models.CharField(max_length=100, blank=True, null=True)
|
||||||
|
@ -352,6 +372,7 @@ class TipoVehiculo(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'tipo_vehiculo'
|
db_table = 'tipo_vehiculo'
|
||||||
|
|
||||||
|
|
||||||
class Usuario(models.Model):
|
class Usuario(models.Model):
|
||||||
login = models.CharField(primary_key=True, max_length=60)
|
login = models.CharField(primary_key=True, max_length=60)
|
||||||
rut = models.ForeignKey(Persona, models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
rut = models.ForeignKey(Persona, models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
||||||
|
@ -364,6 +385,7 @@ class Usuario(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'usuario'
|
db_table = 'usuario'
|
||||||
|
|
||||||
|
|
||||||
class Vehiculo(models.Model):
|
class Vehiculo(models.Model):
|
||||||
ppu = models.CharField(primary_key=True, max_length=10)
|
ppu = models.CharField(primary_key=True, max_length=10)
|
||||||
id_tipo_vehiculo = models.ForeignKey(TipoVehiculo, models.DO_NOTHING, db_column='id_tipo_vehiculo', blank=True, null=True)
|
id_tipo_vehiculo = models.ForeignKey(TipoVehiculo, models.DO_NOTHING, db_column='id_tipo_vehiculo', blank=True, null=True)
|
||||||
|
@ -373,6 +395,7 @@ class Vehiculo(models.Model):
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'vehiculo'
|
db_table = 'vehiculo'
|
||||||
|
|
||||||
|
|
||||||
class VehiculoLinea(models.Model):
|
class VehiculoLinea(models.Model):
|
||||||
patente = models.OneToOneField(Vehiculo, models.DO_NOTHING, db_column='patente', primary_key=True) # The composite primary key (patente, id_linea) found, that is not supported. The first column is selected.
|
patente = models.OneToOneField(Vehiculo, models.DO_NOTHING, db_column='patente', primary_key=True) # The composite primary key (patente, id_linea) found, that is not supported. The first column is selected.
|
||||||
id_linea = models.ForeignKey(Linea, models.DO_NOTHING, db_column='id_linea')
|
id_linea = models.ForeignKey(Linea, models.DO_NOTHING, db_column='id_linea')
|
||||||
|
@ -413,6 +436,7 @@ class GtfsArchivo(models.Model):
|
||||||
db_table = 'gtfs_archivo'
|
db_table = 'gtfs_archivo'
|
||||||
db_table_comment = 'Registro de los archivos GTFS que se cargan en el sistema'
|
db_table_comment = 'Registro de los archivos GTFS que se cargan en el sistema'
|
||||||
|
|
||||||
|
|
||||||
class VistaFuncionario(models.Model):
|
class VistaFuncionario(models.Model):
|
||||||
rut = models.ForeignKey('Persona', models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
rut = models.ForeignKey('Persona', models.DO_NOTHING, db_column='rut', blank=True, null=True)
|
||||||
id_operador = models.ForeignKey('Operador', models.DO_NOTHING, db_column='id_operador', blank=True, null=True)
|
id_operador = models.ForeignKey('Operador', models.DO_NOTHING, db_column='id_operador', blank=True, null=True)
|
||||||
|
|
|
@ -41,12 +41,12 @@ def jwt_login(request):
|
||||||
# solo se permite usuario 0 si no existen usuarios vigentes
|
# solo se permite usuario 0 si no existen usuarios vigentes
|
||||||
count = models.Usuario.objects.filter(vigente = True).count()
|
count = models.Usuario.objects.filter(vigente = True).count()
|
||||||
if count > 0:
|
if count > 0:
|
||||||
return HttpResponse('Acceso no valido 1', status=400)
|
return HttpResponse('Acceso no valido', status=400)
|
||||||
else:
|
else:
|
||||||
usuario = models.Usuario.objects.filter(vigente=1, rut__rut=rut, rut__dv=dv).values().first()
|
usuario = models.Usuario.objects.filter(vigente=1, rut__rut=rut, rut__dv=dv).values().first()
|
||||||
|
|
||||||
if not check_password(input['password'], usuario['clave']):
|
if not check_password(input['password'], usuario['clave']):
|
||||||
return HttpResponse('Acceso no valido 2', status=400)
|
return HttpResponse('Acceso no valido', status=400)
|
||||||
|
|
||||||
ahora = datetime.utcnow()
|
ahora = datetime.utcnow()
|
||||||
manana = ahora + timedelta(days=1)
|
manana = ahora + timedelta(days=1)
|
||||||
|
@ -79,10 +79,10 @@ def recuperar(request):
|
||||||
usuario = models.Usuario.objects.filter(rut=rut, vigente=True).first()
|
usuario = models.Usuario.objects.filter(rut=rut, vigente=True).first()
|
||||||
|
|
||||||
if usuario == None or persona == None:
|
if usuario == None or persona == None:
|
||||||
return HttpResponse('El usuario no existe', status=400)
|
return HttpResponse('Acceso no valido', status=400)
|
||||||
|
|
||||||
if persona.email != input['email'].lower():
|
if persona.email != input['email'].lower():
|
||||||
return HttpResponse('El correo electrónico no es el registrado para el usuario', status=400)
|
return HttpResponse('Acceso no valido', status=400)
|
||||||
|
|
||||||
codigo_aleatorio = random.randint(100000, 999999)
|
codigo_aleatorio = random.randint(100000, 999999)
|
||||||
ahora = datetime.utcnow()
|
ahora = datetime.utcnow()
|
||||||
|
@ -112,7 +112,6 @@ def recuperar(request):
|
||||||
def info_token(request):
|
def info_token(request):
|
||||||
input = json.loads(request.body)
|
input = json.loads(request.body)
|
||||||
token = input['token']
|
token = input['token']
|
||||||
logging.warning(input)
|
|
||||||
try:
|
try:
|
||||||
decoded = jwt.decode(token, SECRET_KEY, algorithms=["HS256"])
|
decoded = jwt.decode(token, SECRET_KEY, algorithms=["HS256"])
|
||||||
persona = models.Persona.objects.filter(rut=decoded['rut']).first()
|
persona = models.Persona.objects.filter(rut=decoded['rut']).first()
|
||||||
|
@ -159,23 +158,27 @@ def nueva_contrasena(request):
|
||||||
return HttpResponse('error al cambiar contraseña', status = 500)
|
return HttpResponse('error al cambiar contraseña', status = 500)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def enviar_correo(destinatario, asunto, contenido):
|
def enviar_correo(destinatario, asunto, contenido):
|
||||||
try:
|
try:
|
||||||
template = get_template('correo_recuperar.html') # Ruta al template del correo
|
template = get_template('correo_recuperar.html') # Ruta al template del correo
|
||||||
contenido_renderizado = template.render(contenido)
|
contenido_renderizado = template.render(contenido)
|
||||||
|
|
||||||
mensaje = EmailMultiAlternatives(asunto, '', settings.EMAIL_SENDER, [destinatario])
|
mensaje = EmailMultiAlternatives(asunto, '', settings.EMAIL_HOST_USER, [destinatario])
|
||||||
mensaje.attach_alternative(contenido_renderizado, 'text/html')
|
mensaje.attach_alternative(contenido_renderizado, 'text/html')
|
||||||
mensaje.send()
|
mensaje.send()
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'EMAIL_HOST: {settings.EMAIL_HOST}', flush=True)
|
print(f'EMAIL_HOST: {EMAIL_HOST}', flush=True)
|
||||||
print(f'ERROR: {e}', flush=True)
|
print(f'ERROR: {e}', flush=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def http_referer(request, clean=False):
|
|
||||||
if 'HTTP_REFERER' in request.META and clean==False:
|
|
||||||
|
def http_referer(request):
|
||||||
|
if 'HTTP_REFERER' in request.META:
|
||||||
referer = request.META['HTTP_REFERER']
|
referer = request.META['HTTP_REFERER']
|
||||||
else:
|
else:
|
||||||
protocol = request.scheme
|
protocol = request.scheme
|
||||||
|
|
|
@ -136,9 +136,6 @@ class DispositivoViewSet(viewsets.ModelViewSet):
|
||||||
hora_llegada = row[0].strftime('%H:%M:%S')
|
hora_llegada = row[0].strftime('%H:%M:%S')
|
||||||
distancia_km = row[1]
|
distancia_km = row[1]
|
||||||
texto_llegada= row[2]
|
texto_llegada= row[2]
|
||||||
if distancia_km == None:
|
|
||||||
distancia_km == 999
|
|
||||||
|
|
||||||
|
|
||||||
llegadas.append({
|
llegadas.append({
|
||||||
'patente': trayecto['vehicle_license_plate'],
|
'patente': trayecto['vehicle_license_plate'],
|
||||||
|
@ -152,12 +149,7 @@ class DispositivoViewSet(viewsets.ModelViewSet):
|
||||||
'Mensajelinea': None,
|
'Mensajelinea': None,
|
||||||
})
|
})
|
||||||
|
|
||||||
try:
|
|
||||||
llegadas_ordendas = sorted(llegadas, key=lambda x: x['DistanciaGPS'])
|
llegadas_ordendas = sorted(llegadas, key=lambda x: x['DistanciaGPS'])
|
||||||
except:
|
|
||||||
logging.debug("No se pueden ordenar: {}".format(llegadas))
|
|
||||||
llegadas_ordendas = llegadas
|
|
||||||
|
|
||||||
|
|
||||||
item = {
|
item = {
|
||||||
'Linea': linea.route_long_name,
|
'Linea': linea.route_long_name,
|
||||||
|
|
|
@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = config('SECRET_KEY')
|
SECRET_KEY = 'django-insecure-ozq@8*t6cy&$lmu@qsvz+l6omsfncj6r1w)s**rtl3vd&j8_#b'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
@ -181,10 +181,7 @@ LOGGING = {
|
||||||
|
|
||||||
|
|
||||||
EMAIL_HOST = config('SMTP_HOST')
|
EMAIL_HOST = config('SMTP_HOST')
|
||||||
EMAIL_PORT = config('SMTP_PORT')
|
EMAIL_PORT = config('SMTP_PORT', 587)
|
||||||
EMAIL_SENDER = config('SMTP_FROM')
|
EMAIL_HOST_USER = config('SMTP_USER', 'tu_correo@gmail.com') # Tu dirección de correo
|
||||||
|
EMAIL_HOST_PASSWORD = config('SMTP_PASS', 'tu_contraseña') # Tu contraseña de correo
|
||||||
|
|
||||||
#EMAIL_HOST_USER = config('SMTP_USER', 'tu_correo@gmail.com') # Tu dirección de correo
|
|
||||||
#EMAIL_HOST_PASSWORD = config('SMTP_PASS', 'tu_contraseña') # Tu contraseña de correo
|
|
||||||
EMAIL_USE_TLS = config('SMTP_PROTOCOL') == 'tls'
|
EMAIL_USE_TLS = config('SMTP_PROTOCOL') == 'tls'
|
Loading…
Reference in New Issue