Enzo Yair

se agregaron filtros y elementos a modelo

... ... @@ -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-27 12:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('edicto', '0004_migracion_dato_uuid'),
]
operations = [
migrations.RemoveField(
model_name='comprobantepago',
name='monto',
),
migrations.AddField(
model_name='comprobantepago',
name='monto_descuento',
field=models.FloatField(editable=False, null=True),
),
migrations.AddField(
model_name='comprobantepago',
name='monto_subtotal',
field=models.FloatField(editable=False, null=True),
),
migrations.AddField(
model_name='comprobantepago',
name='monto_total',
field=models.FloatField(editable=False, null=True),
),
migrations.AddField(
model_name='precio',
name='precio_dia',
field=models.FloatField(default=90.34),
preserve_default=False,
),
migrations.AlterField(
model_name='edicto',
name='creado_por',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='precio',
name='usuario',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
... ...
... ... @@ -13,10 +13,11 @@ class Precio(models.Model):
precio = models.FloatField(max_length=50, blank=False, null=False)
vigencia_desde = models.DateField()
vigencia_hasta = models.DateField(blank=True, null=True)
usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE)
usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE, editable=False)
moneda = models.CharField(max_length=50, blank=False, null=False, choices=MONEDA,
default='peso_argentino')
precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False)
precio_dia = models.FloatField()
class Meta:
verbose_name = 'Precio'
... ... @@ -44,13 +45,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):
... ... @@ -58,7 +59,9 @@ class ComprobantePago(models.Model):
verbose_name = 'ComprobantePago'
verbose_name_plural = 'ComprobantesPagos'
monto = models.FloatField()
monto_total = models.FloatField(editable=False, null=True)
monto_subtotal = models.FloatField(editable=False, null=True)
monto_descuento = models.FloatField(editable=False, null=True)
numero_comprobante = models.CharField(max_length=300, blank=True, null=True)
fecha_pago = models.DateTimeField(blank=True, null=True)
edicto = models.OneToOneField(Edicto, on_delete=models.CASCADE)
... ...