Enzo Yair

migraciones finales

# Generated by Django 4.1.9 on 2023-09-20 12:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('edicto', '0018_alter_edicto_fecha_modificacion'),
]
operations = [
migrations.AddField(
model_name='comprobantepago',
name='archivo',
field=models.FileField(blank=True, upload_to='uploads/%Y/%m/%d/'),
),
migrations.AlterField(
model_name='comprobantepago',
name='edicto',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto'),
),
migrations.AlterField(
model_name='comprobantepago',
name='fecha_pago',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='comprobantepago',
name='monto',
field=models.FloatField(editable=False),
),
migrations.AlterField(
model_name='comprobantepago',
name='numero_comprobante',
field=models.CharField(blank=True, max_length=300, null=True),
),
migrations.AlterField(
model_name='edicto',
name='cantidad_palabras',
field=models.IntegerField(editable=False),
),
migrations.AlterField(
model_name='precio',
name='vigencia_hasta',
field=models.DateField(blank=True, null=True),
),
]
... ...
... ... @@ -11,7 +11,7 @@ from usuario.models import Usuario
class Precio (models.Model):
precio = models.FloatField(max_length=50, blank=False, null=False)
vigencia_desde = models.DateField()
vigencia_hasta = models.DateField()
vigencia_hasta = models.DateField(blank=True, null=True)
usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE)
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)
... ... @@ -32,7 +32,7 @@ class Edicto(models.Model):
dias_publicar = models.PositiveIntegerField(blank=False, null=False)
cantidad_sellos = models.PositiveIntegerField(blank=False, null=False)
estado = models.CharField(max_length=150, choices=STATUS_CHOICE, default='inciado')
cantidad_palabras = models.IntegerField(blank=False, null=False)
cantidad_palabras = models.IntegerField(blank=False, null=False, editable=False)
cantidad_copias = models.PositiveIntegerField(blank=False, null=False)
fecha_publicacion = models.DateField(blank=True, null=True)
observaciones = models.CharField(max_length=500, blank=True, null=True)
... ... @@ -45,14 +45,15 @@ class Edicto(models.Model):
verbose_name_plural = 'Edictos'
def __str__(self):
return self.cuerpo_edicto
return self.usuario
class ComprobantePago(models.Model):
monto = models.FloatField(blank=False, null=False)
numero_comprobante = models.CharField(max_length=300, blank=False, null=True)
fecha_pago = models.DateTimeField(blank=False, null=True)
edicto = models.ForeignKey(Edicto, on_delete=models.CASCADE)
monto = models.FloatField(blank=False, null=False, editable=False)
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)
archivo = models.FileField(upload_to="uploads/%Y/%m/%d/", blank=True, null=False)
class Meta:
verbose_name = 'ComprobantePago'
... ...
... ... @@ -32,7 +32,7 @@ class EdictoSerializer(serializers.ModelSerializer):
)
read_only_fields = ('fecha_publicacion', 'cantidad_palabras',
read_only_fields = ('fecha_publicacion',
)
def validate(self, data):
... ...