diff --git a/app/utils.py b/app/utils.py index e68d0682..2abecee2 100644 --- a/app/utils.py +++ b/app/utils.py @@ -63,5 +63,7 @@ def background_delete_corpus(app, corpus_id): logger.warning('Called by delete_thread.') logger.warning('Corpus id is: {}.'.format(corpus_id)) corpus = Corpus.query.filter_by(id=corpus_id).first() - logger.warning('Corpus object is: {}'.format(corpus)) + for corpus_file in corpus.files: + db.session.delete(corpus_file) + logger.warning('Corpus object is: {}'.format(corpus)) corpus.delete_corpus()