Martín Miranda

Merge branch 'feature/#39_revisar_models_edicto.fecha_creacion' into 'develop'

modificacion en el verbose_name de precio, cambio de DataTimeFields a DataFields…

… en fecha_creacion y cambio de nombre de precio a monto en edicto.ComprobantePago

See merge request !31
... ... @@ -8,7 +8,6 @@ from datetime import datetime
from .models import Edicto, Precio
from .serializer import EdictoSerializer, PrecioSerializer
from .filters import EdictoFilter, PrecioFilter
from .pagination import CustomPagination
from .permissions import IsAdminOrAuthorized
from .utils import contador
... ... @@ -27,7 +26,6 @@ class EdictoViewSet(mixins.CreateModelMixin,
queryset = Edicto.objects.all()
ordering_fields = ('usuario',)
ordering = 'usuario'
pagination_class = CustomPagination
def perform_create(self, serializer):
edicto = self.request.data.get('cuerpo_edicto')
... ... @@ -56,4 +54,3 @@ class PrecioViewSet(viewsets.ReadOnlyModelViewSet):
ordering_fields = ('usuario', )
ordering = 'usuario'
queryset = Precio.objects.all()
pagination_class = CustomPagination
... ...
# Generated by Django 4.1.9 on 2023-09-06 10:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('edicto', '0008_alter_edicto_fecha_publicacion_alter_edicto_usuario'),
]
operations = [
migrations.AlterModelOptions(
name='precio',
options={'verbose_name': 'Precio', 'verbose_name_plural': 'Precios'},
),
migrations.RenameField(
model_name='comprobantepago',
old_name='resultado',
new_name='monto',
),
migrations.AddField(
model_name='comprobantepago',
name='edicto',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto'),
preserve_default=False,
),
]
... ...
# Generated by Django 4.1.9 on 2023-09-06 10:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edicto', '0009_alter_precio_options_and_more'),
]
operations = [
migrations.AlterField(
model_name='edicto',
name='fecha_creacion',
field=models.DateField(auto_now_add=True),
),
]
... ...
... ... @@ -16,8 +16,8 @@ class Precio (models.Model):
precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False)
class Meta:
verbose_name = 'Administrador'
verbose_name_plural = 'Administradores'
verbose_name = 'Precio'
verbose_name_plural = 'Precios'
def __str__(self):
return self.moneda
... ... @@ -34,7 +34,7 @@ class Edicto(models.Model):
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)
fecha_creacion = models.DateTimeField(auto_now_add=True)
fecha_creacion = models.DateField(auto_now_add=True)
fecha_modificacion = models.DateTimeField(auto_now_add=True)
class Meta:
... ... @@ -46,9 +46,10 @@ class Edicto(models.Model):
class ComprobantePago(models.Model):
resultado = models.FloatField(blank=False, null=False)
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)
class Meta:
verbose_name = 'ComprobantePago'
... ...
from rest_framework.pagination import PageNumberPagination
class CustomPagination(PageNumberPagination):
page_size = 2
page_size_query_param = 'page_size'
max_page_size = 1000