|
|
@ -291,9 +291,11 @@ def show_shelf(shelf_type, shelf_id):
|
|
|
|
if cur_book:
|
|
|
|
if cur_book:
|
|
|
|
result.append(cur_book)
|
|
|
|
result.append(cur_book)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.info('Not existing book %s in %s deleted', book.book_id, shelf)
|
|
|
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
|
|
|
ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book.book_id).delete()
|
|
|
|
if not cur_book:
|
|
|
|
ub.session.commit()
|
|
|
|
log.info('Not existing book %s in %s deleted', book.book_id, shelf)
|
|
|
|
|
|
|
|
ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book.book_id).delete()
|
|
|
|
|
|
|
|
ub.session.commit()
|
|
|
|
return render_title_template(page, entries=result, title=_(u"Shelf: '%(name)s'", name=shelf.name),
|
|
|
|
return render_title_template(page, entries=result, title=_(u"Shelf: '%(name)s'", name=shelf.name),
|
|
|
|
shelf=shelf, page="shelf")
|
|
|
|
shelf=shelf, page="shelf")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -327,9 +329,18 @@ def order_shelf(shelf_id):
|
|
|
|
.order_by(ub.BookShelf.order.asc()).all()
|
|
|
|
.order_by(ub.BookShelf.order.asc()).all()
|
|
|
|
for book in books_in_shelf2:
|
|
|
|
for book in books_in_shelf2:
|
|
|
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).filter(common_filters()).first()
|
|
|
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).filter(common_filters()).first()
|
|
|
|
result.append(cur_book)
|
|
|
|
if cur_book:
|
|
|
|
#books_list = [ b.book_id for b in books_in_shelf2]
|
|
|
|
result.append({'title':cur_book.title,
|
|
|
|
#result = db.session.query(db.Books).filter(db.Books.id.in_(books_list)).filter(common_filters()).all()
|
|
|
|
'id':cur_book.id,
|
|
|
|
|
|
|
|
'author':cur_book.authors,
|
|
|
|
|
|
|
|
'series':cur_book.series,
|
|
|
|
|
|
|
|
'series_index':cur_book.series_index})
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
|
|
|
|
|
|
|
result.append({'title':_('Hidden Book'),
|
|
|
|
|
|
|
|
'id':cur_book.id,
|
|
|
|
|
|
|
|
'author':[],
|
|
|
|
|
|
|
|
'series':[]})
|
|
|
|
return render_title_template('shelf_order.html', entries=result,
|
|
|
|
return render_title_template('shelf_order.html', entries=result,
|
|
|
|
title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name),
|
|
|
|
title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name),
|
|
|
|
shelf=shelf, page="shelforder")
|
|
|
|
shelf=shelf, page="shelforder")
|
|
|
|