Showing
3 changed files
with
3 additions
and
10 deletions
@@ -13,6 +13,7 @@ from .utils import contador | @@ -13,6 +13,7 @@ from .utils import contador | ||
13 | 13 | ||
14 | class EdictoViewSet(mixins.CreateModelMixin, | 14 | class EdictoViewSet(mixins.CreateModelMixin, |
15 | mixins.RetrieveModelMixin, | 15 | mixins.RetrieveModelMixin, |
16 | + mixins.UpdateModelMixin, | ||
16 | mixins.ListModelMixin, | 17 | mixins.ListModelMixin, |
17 | viewsets.GenericViewSet): | 18 | viewsets.GenericViewSet): |
18 | 19 |
@@ -36,8 +36,8 @@ class Edicto(models.Model): | @@ -36,8 +36,8 @@ class Edicto(models.Model): | ||
36 | cantidad_copias = models.PositiveIntegerField(blank=False, null=False) | 36 | cantidad_copias = models.PositiveIntegerField(blank=False, null=False) |
37 | fecha_publicacion = models.DateField(blank=True, null=True) | 37 | fecha_publicacion = models.DateField(blank=True, null=True) |
38 | observaciones = models.CharField(max_length=500, blank=True, null=True) | 38 | observaciones = models.CharField(max_length=500, blank=True, null=True) |
39 | - fecha_creacion = models.DateField(auto_now_add=True) | ||
40 | - fecha_modificacion = models.DateTimeField(auto_now_add=True) | 39 | + fecha_creacion = models.DateField(auto_now=True, editable=False) |
40 | + fecha_modificacion = models.DateTimeField(auto_now_add=True, editable=False) | ||
41 | usuario_movimiento = models.ForeignKey(Usuario, on_delete=models.CASCADE, related_name='udate_edicto') | 41 | usuario_movimiento = models.ForeignKey(Usuario, on_delete=models.CASCADE, related_name='udate_edicto') |
42 | 42 | ||
43 | class Meta: | 43 | class Meta: |
@@ -41,14 +41,6 @@ class EdictoSerializer(serializers.ModelSerializer): | @@ -41,14 +41,6 @@ class EdictoSerializer(serializers.ModelSerializer): | ||
41 | 'fecha_modificacion', | 41 | 'fecha_modificacion', |
42 | ) | 42 | ) |
43 | 43 | ||
44 | - def to_representation(self, instance): | ||
45 | - data = super().to_representation(instance) | ||
46 | - if instance.fecha_modificacion is not None and self.context['request'].method == 'PATCH': | ||
47 | - data['fecha_modificacion'] = instance.fecha_modificacion | ||
48 | - else: | ||
49 | - data['fecha_modificacion'] = None | ||
50 | - return data | ||
51 | - | ||
52 | @staticmethod | 44 | @staticmethod |
53 | def validate_archivo(value): | 45 | def validate_archivo(value): |
54 | filename, extension = value.name.rsplit(".", 1) | 46 | filename, extension = value.name.rsplit(".", 1) |
-
Please register or login to post a comment