Showing
2 changed files
with
4 additions
and
3 deletions
@@ -14,6 +14,7 @@ from .utils import contador | @@ -14,6 +14,7 @@ from .utils import contador | ||
14 | 14 | ||
15 | class EdictoViewSet(mixins.CreateModelMixin, | 15 | class EdictoViewSet(mixins.CreateModelMixin, |
16 | mixins.RetrieveModelMixin, | 16 | mixins.RetrieveModelMixin, |
17 | + mixins.UpdateModelMixin, | ||
17 | mixins.ListModelMixin, | 18 | mixins.ListModelMixin, |
18 | viewsets.GenericViewSet): | 19 | viewsets.GenericViewSet): |
19 | 20 | ||
@@ -35,9 +36,9 @@ class EdictoViewSet(mixins.CreateModelMixin, | @@ -35,9 +36,9 @@ class EdictoViewSet(mixins.CreateModelMixin, | ||
35 | usuario_movimiento=usuario, | 36 | usuario_movimiento=usuario, |
36 | ) | 37 | ) |
37 | 38 | ||
38 | - def partial_update(self, request): | 39 | + def update(self, request, *args, **kwargs): |
39 | instance = self.get_object() | 40 | instance = self.get_object() |
40 | - serializer = self.get_serializer(instance, data=request.data, partial=True) | 41 | + serializer = self.get_serializer(instance, data=request.data) |
41 | serializer.is_valid(raise_exception=True) | 42 | serializer.is_valid(raise_exception=True) |
42 | 43 | ||
43 | edicto = request.data.get('cuerpo_edicto') | 44 | edicto = request.data.get('cuerpo_edicto') |
@@ -40,7 +40,7 @@ class EdictoSerializer(serializers.ModelSerializer): | @@ -40,7 +40,7 @@ class EdictoSerializer(serializers.ModelSerializer): | ||
40 | 40 | ||
41 | def to_representation(self, instance): | 41 | def to_representation(self, instance): |
42 | data = super().to_representation(instance) | 42 | data = super().to_representation(instance) |
43 | - if instance.fecha_modificacion is not None and self.context['request'].method == 'PATCH': | 43 | + if instance.fecha_modificacion is not None and self.context['request'].method == 'PUT': |
44 | data['fecha_modificacion'] = instance.fecha_modificacion | 44 | data['fecha_modificacion'] = instance.fecha_modificacion |
45 | else: | 45 | else: |
46 | data['fecha_modificacion'] = None | 46 | data['fecha_modificacion'] = None |
-
Please register or login to post a comment