Martín Miranda

Merge branch 'fix/modelo_edicto' into 'develop'

Fix/modelo edicto



See merge request !53
... ... @@ -63,7 +63,6 @@ class Migration(migrations.Migration):
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
unique=True,
),
... ...
# 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),
),
]
... ...
... ... @@ -31,7 +31,7 @@ class Edicto(models.Model):
verbose_name = 'Edicto'
verbose_name_plural = 'Edictos'
uuid = models.UUIDField(unique=True, editable=False, default=uuid4, primary_key=True)
uuid = models.UUIDField(unique=True, editable=False, default=uuid4)
cuerpo_edicto = models.TextField(blank=False)
archivo = models.FileField(upload_to="uploads/%Y/%m/%d/")
dias_publicar = models.PositiveIntegerField()
... ...
... ... @@ -15,6 +15,7 @@ class EdictoSerializer(serializers.ModelSerializer):
class Meta:
model = Edicto
fields = (
'uuid',
'creado_por',
'modificado_por',
'estado',
... ...