From 38fa9ce206e8f1e59c111a11543e76bc7dc9d9cc Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Fri, 19 May 2017 20:36:58 +0200 Subject: [PATCH] At deleting a book, the book is also deleted from all Shelfs, Download list and read list (#192) --- cps/web.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cps/web.py b/cps/web.py index cd9d9386..2f4b1525 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1290,6 +1290,12 @@ def delete_book(book_id): if current_user.role_delete_books(): book = db.session.query(db.Books).filter(db.Books.id == book_id).first() if book: + # delete book from Shelfs, Downloads, Read list + ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book_id).delete() + ub.session.query(ub.ReadBook).filter(ub.ReadBook.book_id == book_id).delete() + ub.session.query(ub.Downloads).filter(ub.Downloads.book_id == book_id).delete() + ub.session.commit() + if config.config_use_google_drive: helper.delete_book_gdrive(book) # ToDo really delete file else: