Enzo Yair

se elimino decorador @action

... ... @@ -14,6 +14,7 @@ from .utils import contador
class EdictoViewSet(mixins.CreateModelMixin,
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
... ... @@ -35,9 +36,9 @@ class EdictoViewSet(mixins.CreateModelMixin,
usuario_movimiento=usuario,
)
def partial_update(self, request):
def update(self, request, *args, **kwargs):
instance = self.get_object()
serializer = self.get_serializer(instance, data=request.data, partial=True)
serializer = self.get_serializer(instance, data=request.data)
serializer.is_valid(raise_exception=True)
edicto = request.data.get('cuerpo_edicto')
... ...
... ... @@ -40,7 +40,7 @@ class EdictoSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
data = super().to_representation(instance)
if instance.fecha_modificacion is not None and self.context['request'].method == 'PATCH':
if instance.fecha_modificacion is not None and self.context['request'].method == 'PUT':
data['fecha_modificacion'] = instance.fecha_modificacion
else:
data['fecha_modificacion'] = None
... ...