diff --git a/Proyecto/espacios_obligados/migrations/0001_initial.py b/Proyecto/espacios_obligados/migrations/0001_initial.py new file mode 100644 index 0000000..9f3a48c --- /dev/null +++ b/Proyecto/espacios_obligados/migrations/0001_initial.py @@ -0,0 +1,84 @@ +# Generated by Django 4.2.5 on 2023-10-29 22:52 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('usuarios', '__first__'), + ] + + operations = [ + migrations.CreateModel( + name='DEA', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('aprobacion_ANMAT', models.BooleanField(default=False)), + ('marca', models.CharField(max_length=200)), + ('modelo', models.CharField(max_length=200)), + ('numero_serie', models.CharField(max_length=200)), + ('nombre_representativo', models.CharField(max_length=200)), + ('estado', models.CharField(choices=[('activo', 'Activo'), ('inactivo', 'Inactivo')], default='activo', max_length=10)), + ], + ), + migrations.CreateModel( + name='Entidad', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('razon_social', models.CharField(max_length=200)), + ('cuit', models.CharField(max_length=200)), + ('sector', models.CharField(max_length=200)), + ('tipo', models.CharField(max_length=200)), + ], + ), + migrations.CreateModel( + name='Sede', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nombre', models.CharField(max_length=200)), + ('cant_personas_externas', models.IntegerField(default=0)), + ('superficie', models.IntegerField(default=0)), + ('ubicacion', django.contrib.gis.db.models.fields.PointField(srid=4326)), + ('cant_personal', models.IntegerField(default=0)), + ('direccion', models.CharField(max_length=200)), + ('personal_capacitado', models.BooleanField(default=False)), + ('senaletica', models.BooleanField(default=False)), + ('protocolo_accion', models.BooleanField(default=False)), + ('sistema_emergencia', models.BooleanField(default=False)), + ('deas_decreto', models.IntegerField(default=0)), + ('deas_registrados', models.ManyToManyField(blank=True, to='espacios_obligados.dea')), + ('entidad', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='espacios_obligados.entidad')), + ('provincia', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='usuarios.provincias')), + ('representantes', models.ManyToManyField(to='usuarios.representante')), + ], + ), + migrations.CreateModel( + name='HistorialDEA', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('dia', models.DateField()), + ('servicio', models.CharField(max_length=200)), + ('observaciones', models.CharField(blank=True, max_length=200, null=True)), + ('dea', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='espacios_obligados.dea')), + ], + ), + migrations.CreateModel( + name='EspacioObligado', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('estado', models.CharField(default='EN PROCESO', max_length=100)), + ('motivo', models.TextField(blank=True, default='')), + ('sede', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='espacios_obligados.sede')), + ], + ), + migrations.AddField( + model_name='dea', + name='dea_sede', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='espacios_obligados.sede'), + ), + ] diff --git a/Proyecto/espacios_obligados/models.py b/Proyecto/espacios_obligados/models.py index 60518bc..b5d4885 100644 --- a/Proyecto/espacios_obligados/models.py +++ b/Proyecto/espacios_obligados/models.py @@ -23,24 +23,27 @@ class Sede(models.Model): ubicacion = gis_models.PointField() cant_personal = models.IntegerField(default=0) direccion = models.CharField(max_length=200) - - # Declaración Jurada - personal_capacitado = models.BooleanField(default=False) + # Declaración Jurada senaletica = models.BooleanField(default=False) protocolo_accion = models.BooleanField(default=False) sistema_emergencia = models.BooleanField(default=False) deas_registrados = models.ManyToManyField('DEA', blank=True) deas_decreto = models.IntegerField(default=0) - - provincia = models.ForeignKey(Provincias, on_delete=models.CASCADE) entidad = models.ForeignKey(Entidad, on_delete=models.CASCADE) def __str__(self): - return self.nombre + return '%s , %s' % (self.nombre, self.provincia) +class EspacioObligado(models.Model): + estado = models.CharField(max_length=100,default='EN PROCESO') # Agregando el campo estado + sede = models.ForeignKey(Sede, on_delete=models.CASCADE) + motivo= models.TextField(blank=True,default='') + def __str__(self): + return f'!nombre sede {self.sede.nombre} y estado{self.estado}' + class DEA(models.Model): dea_sede = models.ForeignKey(Sede, on_delete=models.CASCADE) aprobacion_ANMAT = models.BooleanField(default=False) @@ -61,4 +64,4 @@ class HistorialDEA(models.Model): observaciones = models.CharField(max_length=200, blank=True, null=True) def __str__(self): - return self.dea.nombre_representativo + return self.estado \ No newline at end of file diff --git a/Proyecto/usuarios/migrations/0001_initial.py b/Proyecto/usuarios/migrations/0001_initial.py new file mode 100644 index 0000000..bcd3f27 --- /dev/null +++ b/Proyecto/usuarios/migrations/0001_initial.py @@ -0,0 +1,74 @@ +# Generated by Django 4.2.5 on 2023-10-29 22:52 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Usuario', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('email', models.EmailField(blank=True, max_length=254, unique=True, verbose_name='Mail')), + ('dni', models.PositiveIntegerField(default='', unique=True, verbose_name='DNI')), + ('nombre', models.CharField(default='', max_length=20, verbose_name='Nombre')), + ('apellido', models.CharField(default='', max_length=20, verbose_name='Apellido')), + ('telefono', models.BigIntegerField(default='', verbose_name='Telefono')), + ('is_active', models.BooleanField(default=True)), + ('tipo_usuario', models.CharField(max_length=20, verbose_name='Tipo de Usuario')), + ('is_staff', models.BooleanField(default=False)), + ('is_admin', models.BooleanField(default=False)), + ], + options={ + 'verbose_name': 'usuario', + 'db_table': 'usuarios', + }, + ), + migrations.CreateModel( + name='Provincias', + fields=[ + ('provincia_id', models.AutoField(primary_key=True, serialize=False)), + ('nombre', models.CharField(default='', max_length=30, verbose_name='Nombre')), + ('validez_certificado', models.PositiveIntegerField(default='', verbose_name='Validez del Certificado')), + ], + options={ + 'verbose_name': 'provincia', + 'db_table': 'provincias', + }, + ), + migrations.CreateModel( + name='Representante', + fields=[ + ('representante_id', models.AutoField(primary_key=True, serialize=False)), + ('fecha_registro', models.DateTimeField(auto_now_add=True)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'representante', + 'db_table': 'representantes', + }, + ), + migrations.CreateModel( + name='AdminProvincial', + fields=[ + ('admin_provincial_id', models.AutoField(primary_key=True, serialize=False)), + ('fecha_registro', models.DateTimeField(auto_now_add=True)), + ('provincias', models.ManyToManyField(related_name='administradores_provinciales', to='usuarios.provincias')), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'administrador provincial', + 'db_table': 'administradores_provinciales', + }, + ), + ] diff --git a/Proyecto/usuarios/templates/adminProvincial/inicioAdminProvincial.html b/Proyecto/usuarios/templates/adminProvincial/inicioAdminProvincial.html index b67ca8d..c065f11 100644 --- a/Proyecto/usuarios/templates/adminProvincial/inicioAdminProvincial.html +++ b/Proyecto/usuarios/templates/adminProvincial/inicioAdminProvincial.html @@ -11,10 +11,46 @@