mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-14 05:44:53 +00:00
Fix deleting user (deleting shelfs and so on failed before)
This commit is contained in:
parent
3b81ea37f4
commit
9a8c342e61
@ -1370,11 +1370,11 @@ def _delete_user(content):
|
|||||||
if content.name != "Guest":
|
if content.name != "Guest":
|
||||||
# Delete all books in shelfs belonging to user, all shelfs of user, downloadstat of user, read status
|
# Delete all books in shelfs belonging to user, all shelfs of user, downloadstat of user, read status
|
||||||
# and user itself
|
# and user itself
|
||||||
ub.session.query(ub.ReadBook).filter(ub.User.id == ub.ReadBook.user_id).delete()
|
ub.session.query(ub.ReadBook).filter(content.id == ub.ReadBook.user_id).delete()
|
||||||
ub.session.query(ub.Downloads).filter(ub.User.id == ub.Downloads.user_id).delete()
|
ub.session.query(ub.Downloads).filter(content.id == ub.Downloads.user_id).delete()
|
||||||
for us in ub.session.query(ub.Shelf).filter(ub.User.id == ub.Shelf.user_id):
|
for us in ub.session.query(ub.Shelf).filter(content.id == ub.Shelf.user_id):
|
||||||
ub.session.query(ub.BookShelf).filter(us.id == ub.BookShelf.shelf).delete()
|
ub.session.query(ub.BookShelf).filter(us.id == ub.BookShelf.shelf).delete()
|
||||||
ub.session.query(ub.Shelf).filter(ub.User.id == ub.Shelf.user_id).delete()
|
ub.session.query(ub.Shelf).filter(content.id == ub.Shelf.user_id).delete()
|
||||||
ub.session.query(ub.User).filter(ub.User.id == content.id).delete()
|
ub.session.query(ub.User).filter(ub.User.id == content.id).delete()
|
||||||
ub.session_commit()
|
ub.session_commit()
|
||||||
log.info(u"User {} deleted".format(content.name))
|
log.info(u"User {} deleted".format(content.name))
|
||||||
|
Loading…
Reference in New Issue
Block a user