Enzo Yair

se agregaron filtros y elementos a modelo

@@ -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-27 12:46
  2 +
  3 +from django.conf import settings
  4 +from django.db import migrations, models
  5 +import django.db.models.deletion
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  12 + ('edicto', '0004_migracion_dato_uuid'),
  13 + ]
  14 +
  15 + operations = [
  16 + migrations.RemoveField(
  17 + model_name='comprobantepago',
  18 + name='monto',
  19 + ),
  20 + migrations.AddField(
  21 + model_name='comprobantepago',
  22 + name='monto_descuento',
  23 + field=models.FloatField(editable=False, null=True),
  24 + ),
  25 + migrations.AddField(
  26 + model_name='comprobantepago',
  27 + name='monto_subtotal',
  28 + field=models.FloatField(editable=False, null=True),
  29 + ),
  30 + migrations.AddField(
  31 + model_name='comprobantepago',
  32 + name='monto_total',
  33 + field=models.FloatField(editable=False, null=True),
  34 + ),
  35 + migrations.AddField(
  36 + model_name='precio',
  37 + name='precio_dia',
  38 + field=models.FloatField(default=90.34),
  39 + preserve_default=False,
  40 + ),
  41 + migrations.AlterField(
  42 + model_name='edicto',
  43 + name='creado_por',
  44 + field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  45 + ),
  46 + migrations.AlterField(
  47 + model_name='precio',
  48 + name='usuario',
  49 + field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  50 + ),
  51 + ]
@@ -13,10 +13,11 @@ class Precio(models.Model): @@ -13,10 +13,11 @@ class Precio(models.Model):
13 precio = models.FloatField(max_length=50, blank=False, null=False) 13 precio = models.FloatField(max_length=50, blank=False, null=False)
14 vigencia_desde = models.DateField() 14 vigencia_desde = models.DateField()
15 vigencia_hasta = models.DateField(blank=True, null=True) 15 vigencia_hasta = models.DateField(blank=True, null=True)
16 - usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE) 16 + usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE, editable=False)
17 moneda = models.CharField(max_length=50, blank=False, null=False, choices=MONEDA, 17 moneda = models.CharField(max_length=50, blank=False, null=False, choices=MONEDA,
18 default='peso_argentino') 18 default='peso_argentino')
19 precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False) 19 precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False)
  20 + precio_dia = models.FloatField()
20 21
21 class Meta: 22 class Meta:
22 verbose_name = 'Precio' 23 verbose_name = 'Precio'
@@ -44,13 +45,13 @@ class Edicto(models.Model): @@ -44,13 +45,13 @@ class Edicto(models.Model):
44 fecha_publicacion = models.DateField(blank=True, null=True) 45 fecha_publicacion = models.DateField(blank=True, null=True)
45 fecha_creacion = models.DateField(auto_now_add=True, editable=False) 46 fecha_creacion = models.DateField(auto_now_add=True, editable=False)
46 fecha_modificacion = models.DateTimeField(auto_now=True, editable=False) 47 fecha_modificacion = models.DateTimeField(auto_now=True, editable=False)
47 - creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, verbose_name='Usuario', editable=False) 48 + creado_por = models.ForeignKey(Usuario, on_delete=models.CASCADE, editable=False)
48 modificado_por = models.ForeignKey( 49 modificado_por = models.ForeignKey(
49 Usuario, on_delete=models.CASCADE, related_name='update_edicto', editable=False 50 Usuario, on_delete=models.CASCADE, related_name='update_edicto', editable=False
50 ) 51 )
51 52
52 def __str__(self): 53 def __str__(self):
53 - return self.creado_por 54 + return f"{self.creado_por} - Edicto"
54 55
55 56
56 class ComprobantePago(models.Model): 57 class ComprobantePago(models.Model):
@@ -58,7 +59,9 @@ class ComprobantePago(models.Model): @@ -58,7 +59,9 @@ class ComprobantePago(models.Model):
58 verbose_name = 'ComprobantePago' 59 verbose_name = 'ComprobantePago'
59 verbose_name_plural = 'ComprobantesPagos' 60 verbose_name_plural = 'ComprobantesPagos'
60 61
61 - monto = models.FloatField() 62 + monto_total = models.FloatField(editable=False, null=True)
  63 + monto_subtotal = models.FloatField(editable=False, null=True)
  64 + monto_descuento = models.FloatField(editable=False, null=True)
62 numero_comprobante = models.CharField(max_length=300, blank=True, null=True) 65 numero_comprobante = models.CharField(max_length=300, blank=True, null=True)
63 fecha_pago = models.DateTimeField(blank=True, null=True) 66 fecha_pago = models.DateTimeField(blank=True, null=True)
64 edicto = models.OneToOneField(Edicto, on_delete=models.CASCADE) 67 edicto = models.OneToOneField(Edicto, on_delete=models.CASCADE)