def patch(self, request, todo_bucket_pk, task_pk): resp = task_interactors.get(pk=task_pk) data = request.DATA task_entity = resp.instance task_entity.bulk_update(**data) #import ipdb;ipdb.set_trace() obj = TaskUpdateSerializer(data=task_entity.to_dict()) if obj.is_valid(): # Update the entities after validation task_entity.bulk_update(**obj.data) response = task_interactors.update(task_entity, update_fields=obj.data.keys()) return make_response(obj=response, serializer_cls=TaskReadSerializer) return Response(status=status.HTTP_400_BAD_REQUEST, data=obj.errors)
def patch(self, request, todo_bucket_pk, task_pk): resp = task_interactors.get(pk=task_pk) data = request.DATA task_entity = resp.instance task_entity.bulk_update(**data) #import ipdb;ipdb.set_trace() obj = TaskUpdateSerializer(data=task_entity.to_dict()) if obj.is_valid(): # Update the entities after validation task_entity.bulk_update(**obj.data) response = task_interactors.update( task_entity, update_fields=obj.data.keys()) return make_response(obj=response, serializer_cls=TaskReadSerializer) return Response(status=status.HTTP_400_BAD_REQUEST, data=obj.errors)
def get(self, request, todo_bucket_pk, task_pk): resp = task_interactors.get(pk=task_pk) return make_response(obj=resp, serializer_cls=TaskReadSerializer)