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 @@ -8,7 +8,6 @@ from datetime import datetime
8 from .models import Edicto, Precio 8 from .models import Edicto, Precio
9 from .serializer import EdictoSerializer, PrecioSerializer 9 from .serializer import EdictoSerializer, PrecioSerializer
10 from .filters import EdictoFilter, PrecioFilter 10 from .filters import EdictoFilter, PrecioFilter
11 -from .pagination import CustomPagination  
12 from .permissions import IsAdminOrAuthorized 11 from .permissions import IsAdminOrAuthorized
13 from .utils import contador 12 from .utils import contador
14 13
@@ -27,7 +26,6 @@ class EdictoViewSet(mixins.CreateModelMixin, @@ -27,7 +26,6 @@ class EdictoViewSet(mixins.CreateModelMixin,
27 queryset = Edicto.objects.all() 26 queryset = Edicto.objects.all()
28 ordering_fields = ('usuario',) 27 ordering_fields = ('usuario',)
29 ordering = 'usuario' 28 ordering = 'usuario'
30 - pagination_class = CustomPagination  
31 29
32 def perform_create(self, serializer): 30 def perform_create(self, serializer):
33 edicto = self.request.data.get('cuerpo_edicto') 31 edicto = self.request.data.get('cuerpo_edicto')
@@ -56,4 +54,3 @@ class PrecioViewSet(viewsets.ReadOnlyModelViewSet): @@ -56,4 +54,3 @@ class PrecioViewSet(viewsets.ReadOnlyModelViewSet):
56 ordering_fields = ('usuario', ) 54 ordering_fields = ('usuario', )
57 ordering = 'usuario' 55 ordering = 'usuario'
58 queryset = Precio.objects.all() 56 queryset = Precio.objects.all()
59 - pagination_class = CustomPagination  
  1 +# Generated by Django 4.1.9 on 2023-09-06 10:15
  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', '0008_alter_edicto_fecha_publicacion_alter_edicto_usuario'),
  11 + ]
  12 +
  13 + operations = [
  14 + migrations.AlterModelOptions(
  15 + name='precio',
  16 + options={'verbose_name': 'Precio', 'verbose_name_plural': 'Precios'},
  17 + ),
  18 + migrations.RenameField(
  19 + model_name='comprobantepago',
  20 + old_name='resultado',
  21 + new_name='monto',
  22 + ),
  23 + migrations.AddField(
  24 + model_name='comprobantepago',
  25 + name='edicto',
  26 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='edicto.edicto'),
  27 + preserve_default=False,
  28 + ),
  29 + ]
  1 +# Generated by Django 4.1.9 on 2023-09-06 10:52
  2 +
  3 +from django.db import migrations, models
  4 +
  5 +
  6 +class Migration(migrations.Migration):
  7 +
  8 + dependencies = [
  9 + ('edicto', '0009_alter_precio_options_and_more'),
  10 + ]
  11 +
  12 + operations = [
  13 + migrations.AlterField(
  14 + model_name='edicto',
  15 + name='fecha_creacion',
  16 + field=models.DateField(auto_now_add=True),
  17 + ),
  18 + ]
@@ -16,8 +16,8 @@ class Precio (models.Model): @@ -16,8 +16,8 @@ class Precio (models.Model):
16 precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False) 16 precio_ejemplar = models.FloatField(max_length=50, blank=False, null=False)
17 17
18 class Meta: 18 class Meta:
19 - verbose_name = 'Administrador'  
20 - verbose_name_plural = 'Administradores' 19 + verbose_name = 'Precio'
  20 + verbose_name_plural = 'Precios'
21 21
22 def __str__(self): 22 def __str__(self):
23 return self.moneda 23 return self.moneda
@@ -34,7 +34,7 @@ class Edicto(models.Model): @@ -34,7 +34,7 @@ class Edicto(models.Model):
34 cantidad_copias = models.PositiveIntegerField(blank=False, null=False) 34 cantidad_copias = models.PositiveIntegerField(blank=False, null=False)
35 fecha_publicacion = models.DateField(blank=True, null=True) 35 fecha_publicacion = models.DateField(blank=True, null=True)
36 observaciones = models.CharField(max_length=500, blank=True, null=True) 36 observaciones = models.CharField(max_length=500, blank=True, null=True)
37 - fecha_creacion = models.DateTimeField(auto_now_add=True) 37 + fecha_creacion = models.DateField(auto_now_add=True)
38 fecha_modificacion = models.DateTimeField(auto_now_add=True) 38 fecha_modificacion = models.DateTimeField(auto_now_add=True)
39 39
40 class Meta: 40 class Meta:
@@ -46,9 +46,10 @@ class Edicto(models.Model): @@ -46,9 +46,10 @@ class Edicto(models.Model):
46 46
47 47
48 class ComprobantePago(models.Model): 48 class ComprobantePago(models.Model):
49 - resultado = models.FloatField(blank=False, null=False) 49 + monto = models.FloatField(blank=False, null=False)
50 numero_comprobante = models.CharField(max_length=300, blank=False, null=True) 50 numero_comprobante = models.CharField(max_length=300, blank=False, null=True)
51 fecha_pago = models.DateTimeField(blank=False, null=True) 51 fecha_pago = models.DateTimeField(blank=False, null=True)
  52 + edicto = models.ForeignKey(Edicto, on_delete=models.CASCADE)
52 53
53 class Meta: 54 class Meta:
54 verbose_name = 'ComprobantePago' 55 verbose_name = 'ComprobantePago'
1 -from rest_framework.pagination import PageNumberPagination  
2 -  
3 -  
4 -class CustomPagination(PageNumberPagination):  
5 - page_size = 2  
6 - page_size_query_param = 'page_size'  
7 - max_page_size = 1000