At deleting a book, the book is also deleted from all Shelfs, Download list and read list (#192)
This commit is contained in:
parent
2b50dea304
commit
38fa9ce206
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user