Showing
3 changed files
with
58 additions
and
8 deletions
project/apps/edicto/migrations/0019_comprobantepago_archivo_alter_comprobantepago_edicto_and_more.py
0 → 100644
1 | +# Generated by Django 4.1.9 on 2023-09-20 12:55 | ||
2 | + | ||
3 | +from django.db import migrations, models | ||
4 | +import django.db.models.deletion | ||
5 | + | ||
6 | + | ||
7 | +class Migration(migrations.Migration): | ||
8 | + | ||
9 | + dependencies = [ | ||
10 | + ('edicto', '0018_alter_edicto_fecha_modificacion'), | ||
11 | + ] | ||
12 | + | ||
13 | + operations = [ | ||
14 | + migrations.AddField( | ||
15 | + model_name='comprobantepago', | ||
16 | + name='archivo', | ||
17 | + field=models.FileField(blank=True, upload_to='uploads/%Y/%m/%d/'), | ||
18 | + ), | ||
19 | + migrations.AlterField( | ||
20 | + model_name='comprobantepago', | ||
21 | + name='edicto', | ||
22 | + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto'), | ||
23 | + ), | ||
24 | + migrations.AlterField( | ||
25 | + model_name='comprobantepago', | ||
26 | + name='fecha_pago', | ||
27 | + field=models.DateTimeField(blank=True, null=True), | ||
28 | + ), | ||
29 | + migrations.AlterField( | ||
30 | + model_name='comprobantepago', | ||
31 | + name='monto', | ||
32 | + field=models.FloatField(editable=False), | ||
33 | + ), | ||
34 | + migrations.AlterField( | ||
35 | + model_name='comprobantepago', | ||
36 | + name='numero_comprobante', | ||
37 | + field=models.CharField(blank=True, max_length=300, null=True), | ||
38 | + ), | ||
39 | + migrations.AlterField( | ||
40 | + model_name='edicto', | ||
41 | + name='cantidad_palabras', | ||
42 | + field=models.IntegerField(editable=False), | ||
43 | + ), | ||
44 | + migrations.AlterField( | ||
45 | + model_name='precio', | ||
46 | + name='vigencia_hasta', | ||
47 | + field=models.DateField(blank=True, null=True), | ||
48 | + ), | ||
49 | + ] |
@@ -11,7 +11,7 @@ from usuario.models import Usuario | @@ -11,7 +11,7 @@ from usuario.models import Usuario | ||
11 | class Precio (models.Model): | 11 | class Precio (models.Model): |
12 | precio = models.FloatField(max_length=50, blank=False, null=False) | 12 | precio = models.FloatField(max_length=50, blank=False, null=False) |
13 | vigencia_desde = models.DateField() | 13 | vigencia_desde = models.DateField() |
14 | - vigencia_hasta = models.DateField() | 14 | + vigencia_hasta = models.DateField(blank=True, null=True) |
15 | usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE) | 15 | usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE) |
16 | moneda = models.CharField(max_length=50, blank=False, null=False, choices=MONEDA, default='peso_argentino') | 16 | moneda = models.CharField(max_length=50, blank=False, null=False, choices=MONEDA, default='peso_argentino') |
17 | precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False) | 17 | precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False) |
@@ -32,7 +32,7 @@ class Edicto(models.Model): | @@ -32,7 +32,7 @@ class Edicto(models.Model): | ||
32 | dias_publicar = models.PositiveIntegerField(blank=False, null=False) | 32 | dias_publicar = models.PositiveIntegerField(blank=False, null=False) |
33 | cantidad_sellos = models.PositiveIntegerField(blank=False, null=False) | 33 | cantidad_sellos = models.PositiveIntegerField(blank=False, null=False) |
34 | estado = models.CharField(max_length=150, choices=STATUS_CHOICE, default='inciado') | 34 | estado = models.CharField(max_length=150, choices=STATUS_CHOICE, default='inciado') |
35 | - cantidad_palabras = models.IntegerField(blank=False, null=False) | 35 | + cantidad_palabras = models.IntegerField(blank=False, null=False, editable=False) |
36 | cantidad_copias = models.PositiveIntegerField(blank=False, null=False) | 36 | cantidad_copias = models.PositiveIntegerField(blank=False, null=False) |
37 | fecha_publicacion = models.DateField(blank=True, null=True) | 37 | fecha_publicacion = models.DateField(blank=True, null=True) |
38 | observaciones = models.CharField(max_length=500, blank=True, null=True) | 38 | observaciones = models.CharField(max_length=500, blank=True, null=True) |
@@ -45,14 +45,15 @@ class Edicto(models.Model): | @@ -45,14 +45,15 @@ class Edicto(models.Model): | ||
45 | verbose_name_plural = 'Edictos' | 45 | verbose_name_plural = 'Edictos' |
46 | 46 | ||
47 | def __str__(self): | 47 | def __str__(self): |
48 | - return self.cuerpo_edicto | 48 | + return self.usuario |
49 | 49 | ||
50 | 50 | ||
51 | class ComprobantePago(models.Model): | 51 | class ComprobantePago(models.Model): |
52 | - monto = models.FloatField(blank=False, null=False) | ||
53 | - numero_comprobante = models.CharField(max_length=300, blank=False, null=True) | ||
54 | - fecha_pago = models.DateTimeField(blank=False, null=True) | ||
55 | - edicto = models.ForeignKey(Edicto, on_delete=models.CASCADE) | 52 | + monto = models.FloatField(blank=False, null=False, editable=False) |
53 | + numero_comprobante = models.CharField(max_length=300, blank=True, null=True) | ||
54 | + fecha_pago = models.DateTimeField(blank=True, null=True) | ||
55 | + edicto = models.OneToOneField(Edicto, on_delete=models.CASCADE) | ||
56 | + archivo = models.FileField(upload_to="uploads/%Y/%m/%d/", blank=True, null=False) | ||
56 | 57 | ||
57 | class Meta: | 58 | class Meta: |
58 | verbose_name = 'ComprobantePago' | 59 | verbose_name = 'ComprobantePago' |
@@ -32,7 +32,7 @@ class EdictoSerializer(serializers.ModelSerializer): | @@ -32,7 +32,7 @@ class EdictoSerializer(serializers.ModelSerializer): | ||
32 | 32 | ||
33 | ) | 33 | ) |
34 | 34 | ||
35 | - read_only_fields = ('fecha_publicacion', 'cantidad_palabras', | 35 | + read_only_fields = ('fecha_publicacion', |
36 | ) | 36 | ) |
37 | 37 | ||
38 | def validate(self, data): | 38 | def validate(self, data): |
-
Please register or login to post a comment