forked from TDTP/admin_transporte_backend
Compare commits
17 Commits
develop/Ro
...
master
Author | SHA1 | Date |
---|---|---|
|
79dd7c49e5 | |
|
1238da5e08 | |
|
5ff56e9e34 | |
|
e820757cbe | |
|
34071769c4 | |
|
056887f67f | |
|
5ace0c1828 | |
|
d54c08f356 | |
|
e540991ac0 | |
|
a4472baa84 | |
|
99d55c0b36 | |
|
dbaa8ebcfe | |
|
2ae8f790f4 | |
|
8af4239459 | |
|
147e5e3126 | |
|
324d53ff72 | |
|
c36dc582ae |
|
@ -20,8 +20,6 @@ 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,8 +14,6 @@ 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,16 +103,6 @@ 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.error(match)
|
logging.info(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,7 +8,6 @@
|
||||||
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)
|
||||||
|
@ -19,7 +18,6 @@ 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)
|
||||||
|
@ -29,7 +27,6 @@ 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)
|
||||||
|
@ -39,7 +36,6 @@ 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)
|
||||||
|
@ -51,7 +47,6 @@ 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)
|
||||||
|
@ -63,7 +58,6 @@ 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()
|
||||||
|
@ -177,7 +171,6 @@ 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')
|
||||||
|
@ -187,7 +180,6 @@ 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)
|
||||||
|
@ -196,7 +188,6 @@ 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)
|
||||||
|
@ -213,7 +204,6 @@ 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)
|
||||||
|
@ -235,7 +225,6 @@ 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')
|
||||||
|
@ -246,7 +235,6 @@ 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)
|
||||||
|
@ -273,7 +261,6 @@ 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)
|
||||||
|
@ -282,9 +269,6 @@ 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)
|
||||||
|
@ -301,7 +285,6 @@ 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'
|
||||||
|
@ -327,7 +310,6 @@ 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)
|
||||||
|
@ -336,7 +318,6 @@ 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)
|
||||||
|
@ -363,7 +344,6 @@ 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)
|
||||||
|
@ -372,7 +352,6 @@ 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)
|
||||||
|
@ -385,7 +364,6 @@ 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)
|
||||||
|
@ -395,7 +373,6 @@ 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')
|
||||||
|
@ -436,7 +413,6 @@ 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', status=400)
|
return HttpResponse('Acceso no valido 1', 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', status=400)
|
return HttpResponse('Acceso no valido 2', 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('Acceso no valido', status=400)
|
return HttpResponse('El usuario no existe', status=400)
|
||||||
|
|
||||||
if persona.email != input['email'].lower():
|
if persona.email != input['email'].lower():
|
||||||
return HttpResponse('Acceso no valido', status=400)
|
return HttpResponse('El correo electrónico no es el registrado para el usuario', status=400)
|
||||||
|
|
||||||
codigo_aleatorio = random.randint(100000, 999999)
|
codigo_aleatorio = random.randint(100000, 999999)
|
||||||
ahora = datetime.utcnow()
|
ahora = datetime.utcnow()
|
||||||
|
@ -112,6 +112,7 @@ 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()
|
||||||
|
@ -158,27 +159,23 @@ 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_HOST_USER, [destinatario])
|
mensaje = EmailMultiAlternatives(asunto, '', settings.EMAIL_SENDER, [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: {EMAIL_HOST}', flush=True)
|
print(f'EMAIL_HOST: {settings.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,6 +136,9 @@ 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'],
|
||||||
|
@ -149,7 +152,12 @@ 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 = 'django-insecure-ozq@8*t6cy&$lmu@qsvz+l6omsfncj6r1w)s**rtl3vd&j8_#b'
|
SECRET_KEY = config('SECRET_KEY')
|
||||||
|
|
||||||
# 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,7 +181,10 @@ LOGGING = {
|
||||||
|
|
||||||
|
|
||||||
EMAIL_HOST = config('SMTP_HOST')
|
EMAIL_HOST = config('SMTP_HOST')
|
||||||
EMAIL_PORT = config('SMTP_PORT', 587)
|
EMAIL_PORT = config('SMTP_PORT')
|
||||||
EMAIL_HOST_USER = config('SMTP_USER', 'tu_correo@gmail.com') # Tu dirección de correo
|
EMAIL_SENDER = config('SMTP_FROM')
|
||||||
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