Marta Miranda

Merge branch 'develop' of http://gitlab.catamarca.gob.ar/mvmiranda/boletin_api i…

…nto feature/#67_agregar_auditorias
@@ -8,6 +8,7 @@ class EdictoFilter(filters.FilterSet): @@ -8,6 +8,7 @@ class EdictoFilter(filters.FilterSet):
8 class Meta: 8 class Meta:
9 model = Edicto 9 model = Edicto
10 fields = {'creado_por': ['exact'], 10 fields = {'creado_por': ['exact'],
  11 + 'modificado_por': ['exact'],
11 'estado': ['exact'], 12 'estado': ['exact'],
12 'uuid': ['exact'], 13 'uuid': ['exact'],
13 } 14 }
1 -# Generated by Django 4.1.9 on 2023-09-21 13:18 1 +# Generated by Django 4.1.9 on 2023-09-27 14:12
2 2
3 from django.conf import settings 3 from django.conf import settings
4 from django.db import migrations, models 4 from django.db import migrations, models
@@ -7,6 +7,7 @@ import uuid @@ -7,6 +7,7 @@ import uuid
7 7
8 8
9 class Migration(migrations.Migration): 9 class Migration(migrations.Migration):
  10 +
10 initial = True 11 initial = True
11 12
12 dependencies = [ 13 dependencies = [
@@ -15,141 +16,58 @@ class Migration(migrations.Migration): @@ -15,141 +16,58 @@ class Migration(migrations.Migration):
15 16
16 operations = [ 17 operations = [
17 migrations.CreateModel( 18 migrations.CreateModel(
18 - name="Precio", 19 + name='Precio',
19 fields=[ 20 fields=[
20 - (  
21 - "id",  
22 - models.BigAutoField(  
23 - auto_created=True,  
24 - primary_key=True,  
25 - serialize=False,  
26 - verbose_name="ID",  
27 - ),  
28 - ),  
29 - ("precio", models.FloatField(max_length=50)),  
30 - ("vigencia_desde", models.DateField()),  
31 - ("vigencia_hasta", models.DateField(blank=True, null=True)),  
32 - (  
33 - "moneda",  
34 - models.CharField(  
35 - choices=[  
36 - ("peso_argentino", "peso_argentino"),  
37 - ("dolar", "dolar"),  
38 - ("euro", "euro"),  
39 - ],  
40 - default="peso_argentino",  
41 - max_length=50,  
42 - ),  
43 - ),  
44 - ("precio_ejemplar", models.FloatField(max_length=50)),  
45 - (  
46 - "usuario",  
47 - models.ForeignKey(  
48 - on_delete=django.db.models.deletion.CASCADE,  
49 - to=settings.AUTH_USER_MODEL,  
50 - ),  
51 - ), 21 + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  22 + ('precio', models.FloatField(max_length=50)),
  23 + ('vigencia_desde', models.DateField()),
  24 + ('vigencia_hasta', models.DateField(blank=True, null=True)),
  25 + ('moneda', models.CharField(choices=[('peso_argentino', 'peso_argentino'), ('dolar', 'dolar'), ('euro', 'euro')], default='peso_argentino', max_length=50)),
  26 + ('precio_ejemplar', models.FloatField(max_length=50)),
  27 + ('usuario', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
52 ], 28 ],
53 options={ 29 options={
54 - "verbose_name": "Precio",  
55 - "verbose_name_plural": "Precios", 30 + 'verbose_name': 'Precio',
  31 + 'verbose_name_plural': 'Precios',
56 }, 32 },
57 ), 33 ),
58 migrations.CreateModel( 34 migrations.CreateModel(
59 - name="Edicto", 35 + name='Edicto',
60 fields=[ 36 fields=[
61 - (  
62 - "uuid",  
63 - models.UUIDField(  
64 - default=uuid.uuid4,  
65 - editable=False,  
66 - primary_key=True,  
67 - serialize=False,  
68 - unique=True,  
69 - ),  
70 - ),  
71 - ("cuerpo_edicto", models.TextField()),  
72 - ("archivo", models.FileField(upload_to="uploads/%Y/%m/%d/")),  
73 - ("dias_publicar", models.PositiveIntegerField()),  
74 - ("cantidad_sellos", models.PositiveIntegerField()),  
75 - (  
76 - "estado",  
77 - models.CharField(  
78 - choices=[  
79 - ("iniciado", "iniciado"),  
80 - ("pendiente_revision", "pendiente_revision"),  
81 - ("pendiente_de_pago", "pendiente_de_pago"),  
82 - ("pendiente_pago_revision", "pendiente_pago_revision"),  
83 - ("publicado", "publicado"),  
84 - ("aprobado", "aprobado"),  
85 - ("rechazado", "rechazado"),  
86 - ],  
87 - default="inciado",  
88 - max_length=23,  
89 - ),  
90 - ),  
91 - ("cantidad_palabras", models.IntegerField(editable=False)),  
92 - ("cantidad_copias", models.PositiveIntegerField()),  
93 - ("observaciones", models.CharField(blank=True, max_length=500)),  
94 - ("fecha_publicacion", models.DateField(blank=True, null=True)),  
95 - ("fecha_creacion", models.DateField(auto_now_add=True)),  
96 - ("fecha_modificacion", models.DateTimeField(auto_now=True)),  
97 - (  
98 - "creado_por",  
99 - models.ForeignKey(  
100 - editable=False,  
101 - on_delete=django.db.models.deletion.CASCADE,  
102 - to=settings.AUTH_USER_MODEL,  
103 - verbose_name="Usuario",  
104 - ),  
105 - ),  
106 - (  
107 - "modificado_por",  
108 - models.ForeignKey(  
109 - editable=False,  
110 - on_delete=django.db.models.deletion.CASCADE,  
111 - related_name="update_edicto",  
112 - to=settings.AUTH_USER_MODEL,  
113 - ),  
114 - ), 37 + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  38 + ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
  39 + ('cuerpo_edicto', models.TextField()),
  40 + ('archivo', models.FileField(upload_to='uploads/%Y/%m/%d/')),
  41 + ('dias_publicar', models.PositiveIntegerField()),
  42 + ('cantidad_sellos', models.PositiveIntegerField()),
  43 + ('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)),
  44 + ('cantidad_palabras', models.IntegerField(editable=False)),
  45 + ('cantidad_copias', models.PositiveIntegerField()),
  46 + ('observaciones', models.CharField(blank=True, max_length=500)),
  47 + ('fecha_publicacion', models.DateField(blank=True, null=True)),
  48 + ('fecha_creacion', models.DateField(auto_now_add=True)),
  49 + ('fecha_modificacion', models.DateTimeField(auto_now=True)),
  50 + ('creado_por', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  51 + ('modificado_por', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='update_edicto', to=settings.AUTH_USER_MODEL)),
115 ], 52 ],
116 options={ 53 options={
117 - "verbose_name": "Edicto",  
118 - "verbose_name_plural": "Edictos", 54 + 'verbose_name': 'Edicto',
  55 + 'verbose_name_plural': 'Edictos',
119 }, 56 },
120 ), 57 ),
121 migrations.CreateModel( 58 migrations.CreateModel(
122 - name="ComprobantePago", 59 + name='ComprobantePago',
123 fields=[ 60 fields=[
124 - (  
125 - "id",  
126 - models.BigAutoField(  
127 - auto_created=True,  
128 - primary_key=True,  
129 - serialize=False,  
130 - verbose_name="ID",  
131 - ),  
132 - ),  
133 - ("monto", models.FloatField()),  
134 - (  
135 - "numero_comprobante",  
136 - models.CharField(blank=True, max_length=300, null=True),  
137 - ),  
138 - ("fecha_pago", models.DateTimeField(blank=True, null=True)),  
139 - (  
140 - "archivo",  
141 - models.FileField(blank=True, upload_to="uploads/%Y/%m/%d/"),  
142 - ),  
143 - (  
144 - "edicto",  
145 - models.OneToOneField(  
146 - on_delete=django.db.models.deletion.CASCADE, to="edicto.edicto"  
147 - ),  
148 - ), 61 + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  62 + ('monto', models.FloatField()),
  63 + ('numero_comprobante', models.CharField(blank=True, max_length=300, null=True)),
  64 + ('fecha_pago', models.DateTimeField(blank=True, null=True)),
  65 + ('archivo', models.FileField(blank=True, upload_to='uploads/%Y/%m/%d/')),
  66 + ('edicto', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto')),
149 ], 67 ],
150 options={ 68 options={
151 - "verbose_name": "ComprobantePago",  
152 - "verbose_name_plural": "ComprobantesPagos", 69 + 'verbose_name': 'ComprobantePago',
  70 + 'verbose_name_plural': 'ComprobantesPagos',
153 }, 71 },
154 ), 72 ),
155 ] 73 ]
1 -# Generated by Django 4.1.9 on 2023-09-25 11:23  
2 -  
3 -from django.db import migrations, models  
4 -  
5 -  
6 -class Migration(migrations.Migration):  
7 -  
8 - dependencies = [  
9 - ('edicto', '0001_initial'),  
10 - ]  
11 -  
12 - operations = [  
13 - migrations.RemoveField(  
14 - model_name='edicto',  
15 - name='uuid',  
16 - ),  
17 - migrations.AddField(  
18 - model_name='edicto',  
19 - name='id',  
20 - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),  
21 - preserve_default=False,  
22 - ),  
23 - ]  
1 -# Generated by Django 4.1.9 on 2023-09-25 11:29  
2 -  
3 -from django.db import migrations, models  
4 -import uuid  
5 -  
6 -  
7 -class Migration(migrations.Migration):  
8 -  
9 - dependencies = [  
10 - ('edicto', '0002_remove_edicto_uuid_edicto_id'),  
11 - ]  
12 -  
13 - operations = [  
14 - migrations.AddField(  
15 - model_name='edicto',  
16 - name='uuid',  
17 - field=models.UUIDField(default=uuid.uuid4, editable=False, null=True, unique=True),  
18 - ),  
19 - ]  
1 -# Generated by Django 4.1.9 on 2023-09-25 11:35  
2 -  
3 -from django.db import migrations, models  
4 -import uuid  
5 -  
6 -  
7 -def migrar_datos_uuid(apps, schema):  
8 - Edictos = apps.get_model('edicto', 'Edicto')  
9 - for edicto in Edictos.objects.all():  
10 - edicto.uuid = uuid.uuid4()  
11 - edicto.save()  
12 -  
13 -  
14 -class Migration(migrations.Migration):  
15 -  
16 - dependencies = [  
17 - ('edicto', '0003_edicto_uuid'),  
18 - ]  
19 -  
20 - operations = [  
21 - migrations.RunPython(migrar_datos_uuid, reverse_code=migrations.RunPython.noop),  
22 - migrations.AlterField(  
23 - model_name='edicto',  
24 - name='uuid',  
25 - field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),  
26 - ),  
27 - ]  
@@ -44,13 +44,13 @@ class Edicto(models.Model): @@ -44,13 +44,13 @@ class Edicto(models.Model):
44 fecha_publicacion = models.DateField(blank=True, null=True) 44 fecha_publicacion = models.DateField(blank=True, null=True)
45 fecha_creacion = models.DateField(auto_now_add=True, editable=False) 45 fecha_creacion = models.DateField(auto_now_add=True, editable=False)
46 fecha_modificacion = models.DateTimeField(auto_now=True, editable=False) 46 fecha_modificacion = models.DateTimeField(auto_now=True, editable=False)
47 - creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, verbose_name='Usuario', editable=False) 47 + creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, editable=False)
48 modificado_por = models.ForeignKey( 48 modificado_por = models.ForeignKey(
49 Usuario, on_delete=models.CASCADE, related_name='update_edicto', editable=False 49 Usuario, on_delete=models.CASCADE, related_name='update_edicto', editable=False
50 ) 50 )
51 51
52 def __str__(self): 52 def __str__(self):
53 - return self.creado_por 53 + return f"{self.creado_por} - Edicto"
54 54
55 55
56 class ComprobantePago(models.Model): 56 class ComprobantePago(models.Model):