Enzo Yair

Merge branch 'migracion/edicto' into 'develop'

Migracion/edicto



See merge request !60
... ... @@ -8,6 +8,7 @@ class EdictoFilter(filters.FilterSet):
class Meta:
model = Edicto
fields = {'creado_por': ['exact'],
'modificado_por': ['exact'],
'estado': ['exact'],
'uuid': ['exact'],
}
... ...
# Generated by Django 4.1.9 on 2023-09-21 13:18
# Generated by Django 4.1.9 on 2023-09-27 14:12
from django.conf import settings
from django.db import migrations, models
... ... @@ -7,6 +7,7 @@ import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
... ... @@ -15,141 +16,58 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name="Precio",
name='Precio',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("precio", models.FloatField(max_length=50)),
("vigencia_desde", models.DateField()),
("vigencia_hasta", models.DateField(blank=True, null=True)),
(
"moneda",
models.CharField(
choices=[
("peso_argentino", "peso_argentino"),
("dolar", "dolar"),
("euro", "euro"),
],
default="peso_argentino",
max_length=50,
),
),
("precio_ejemplar", models.FloatField(max_length=50)),
(
"usuario",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('precio', models.FloatField(max_length=50)),
('vigencia_desde', models.DateField()),
('vigencia_hasta', models.DateField(blank=True, null=True)),
('moneda', models.CharField(choices=[('peso_argentino', 'peso_argentino'), ('dolar', 'dolar'), ('euro', 'euro')], default='peso_argentino', max_length=50)),
('precio_ejemplar', models.FloatField(max_length=50)),
('usuario', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
"verbose_name": "Precio",
"verbose_name_plural": "Precios",
'verbose_name': 'Precio',
'verbose_name_plural': 'Precios',
},
),
migrations.CreateModel(
name="Edicto",
name='Edicto',
fields=[
(
"uuid",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
unique=True,
),
),
("cuerpo_edicto", models.TextField()),
("archivo", models.FileField(upload_to="uploads/%Y/%m/%d/")),
("dias_publicar", models.PositiveIntegerField()),
("cantidad_sellos", models.PositiveIntegerField()),
(
"estado",
models.CharField(
choices=[
("iniciado", "iniciado"),
("pendiente_revision", "pendiente_revision"),
("pendiente_de_pago", "pendiente_de_pago"),
("pendiente_pago_revision", "pendiente_pago_revision"),
("publicado", "publicado"),
("aprobado", "aprobado"),
("rechazado", "rechazado"),
],
default="inciado",
max_length=23,
),
),
("cantidad_palabras", models.IntegerField(editable=False)),
("cantidad_copias", models.PositiveIntegerField()),
("observaciones", models.CharField(blank=True, max_length=500)),
("fecha_publicacion", models.DateField(blank=True, null=True)),
("fecha_creacion", models.DateField(auto_now_add=True)),
("fecha_modificacion", models.DateTimeField(auto_now=True)),
(
"creado_por",
models.ForeignKey(
editable=False,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
verbose_name="Usuario",
),
),
(
"modificado_por",
models.ForeignKey(
editable=False,
on_delete=django.db.models.deletion.CASCADE,
related_name="update_edicto",
to=settings.AUTH_USER_MODEL,
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('cuerpo_edicto', models.TextField()),
('archivo', models.FileField(upload_to='uploads/%Y/%m/%d/')),
('dias_publicar', models.PositiveIntegerField()),
('cantidad_sellos', models.PositiveIntegerField()),
('estado', models.CharField(choices=[('iniciado', 'iniciado'), ('pendiente_revision', 'pendiente_revision'), ('pendiente_de_pago', 'pendiente_de_pago'), ('pendiente_pago_revision', 'pendiente_pago_revision'), ('publicado', 'publicado'), ('aprobado', 'aprobado'), ('rechazado', 'rechazado')], default='inciado', max_length=23)),
('cantidad_palabras', models.IntegerField(editable=False)),
('cantidad_copias', models.PositiveIntegerField()),
('observaciones', models.CharField(blank=True, max_length=500)),
('fecha_publicacion', models.DateField(blank=True, null=True)),
('fecha_creacion', models.DateField(auto_now_add=True)),
('fecha_modificacion', models.DateTimeField(auto_now=True)),
('creado_por', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('modificado_por', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='update_edicto', to=settings.AUTH_USER_MODEL)),
],
options={
"verbose_name": "Edicto",
"verbose_name_plural": "Edictos",
'verbose_name': 'Edicto',
'verbose_name_plural': 'Edictos',
},
),
migrations.CreateModel(
name="ComprobantePago",
name='ComprobantePago',
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("monto", models.FloatField()),
(
"numero_comprobante",
models.CharField(blank=True, max_length=300, null=True),
),
("fecha_pago", models.DateTimeField(blank=True, null=True)),
(
"archivo",
models.FileField(blank=True, upload_to="uploads/%Y/%m/%d/"),
),
(
"edicto",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to="edicto.edicto"
),
),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('monto', models.FloatField()),
('numero_comprobante', models.CharField(blank=True, max_length=300, null=True)),
('fecha_pago', models.DateTimeField(blank=True, null=True)),
('archivo', models.FileField(blank=True, upload_to='uploads/%Y/%m/%d/')),
('edicto', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto')),
],
options={
"verbose_name": "ComprobantePago",
"verbose_name_plural": "ComprobantesPagos",
'verbose_name': 'ComprobantePago',
'verbose_name_plural': 'ComprobantesPagos',
},
),
]
... ...
# Generated by Django 4.1.9 on 2023-09-25 11:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edicto', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='edicto',
name='uuid',
),
migrations.AddField(
model_name='edicto',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
preserve_default=False,
),
]
# Generated by Django 4.1.9 on 2023-09-25 11:29
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('edicto', '0002_remove_edicto_uuid_edicto_id'),
]
operations = [
migrations.AddField(
model_name='edicto',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False, null=True, unique=True),
),
]
# Generated by Django 4.1.9 on 2023-09-25 11:35
from django.db import migrations, models
import uuid
def migrar_datos_uuid(apps, schema):
Edictos = apps.get_model('edicto', 'Edicto')
for edicto in Edictos.objects.all():
edicto.uuid = uuid.uuid4()
edicto.save()
class Migration(migrations.Migration):
dependencies = [
('edicto', '0003_edicto_uuid'),
]
operations = [
migrations.RunPython(migrar_datos_uuid, reverse_code=migrations.RunPython.noop),
migrations.AlterField(
model_name='edicto',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
),
]
... ... @@ -44,13 +44,13 @@ class Edicto(models.Model):
fecha_publicacion = models.DateField(blank=True, null=True)
fecha_creacion = models.DateField(auto_now_add=True, editable=False)
fecha_modificacion = models.DateTimeField(auto_now=True, editable=False)
creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, verbose_name='Usuario', editable=False)
creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, editable=False)
modificado_por = models.ForeignKey(
Usuario, on_delete=models.CASCADE, related_name='update_edicto', editable=False
)
def __str__(self):
return self.creado_por
return f"{self.creado_por} - Edicto"
class ComprobantePago(models.Model):
... ...