mirror of
https://github.com/JonathanHerrewijnen/calibre-web.git
synced 2024-11-11 05:33:57 +00:00
Further fix delete books (#119)
This commit is contained in:
parent
9c679c8908
commit
2b8c29c535
25
cps/web.py
25
cps/web.py
@ -1302,19 +1302,20 @@ def delete_book(book_id):
|
|||||||
for c in cc:
|
for c in cc:
|
||||||
cc_string = "custom_column_" + str(c.id)
|
cc_string = "custom_column_" + str(c.id)
|
||||||
if not c.is_multiple:
|
if not c.is_multiple:
|
||||||
if c.datatype == 'bool':
|
if len(getattr(book, cc_string)) > 0:
|
||||||
del_cc = getattr(book, cc_string)[0]
|
if c.datatype == 'bool':
|
||||||
getattr(book, cc_string).remove(del_cc)
|
del_cc = getattr(book, cc_string)[0]
|
||||||
db.session.delete(del_cc)
|
getattr(book, cc_string).remove(del_cc)
|
||||||
elif c.datatype == 'rating':
|
db.session.delete(del_cc)
|
||||||
del_cc = getattr(book, cc_string)[0]
|
elif c.datatype == 'rating':
|
||||||
getattr(book, cc_string).remove(del_cc)
|
del_cc = getattr(book, cc_string)[0]
|
||||||
if len(del_cc.books) == 0:
|
getattr(book, cc_string).remove(del_cc)
|
||||||
|
if len(del_cc.books) == 0:
|
||||||
|
db.session.delete(del_cc)
|
||||||
|
else:
|
||||||
|
del_cc = getattr(book, cc_string)[0]
|
||||||
|
getattr(book, cc_string).remove(del_cc)
|
||||||
db.session.delete(del_cc)
|
db.session.delete(del_cc)
|
||||||
else:
|
|
||||||
del_cc = getattr(book, cc_string)[0]
|
|
||||||
getattr(book, cc_string).remove(del_cc)
|
|
||||||
db.session.delete(del_cc)
|
|
||||||
else:
|
else:
|
||||||
modify_database_object([u''], getattr(book, cc_string),db.cc_classes[c.id], db.session, 'custom')
|
modify_database_object([u''], getattr(book, cc_string),db.cc_classes[c.id], db.session, 'custom')
|
||||||
db.session.query(db.Books).filter(db.Books.id == book_id).delete()
|
db.session.query(db.Books).filter(db.Books.id == book_id).delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user