def GET(self): loans = borrow.get_all_loans() # Preload books web.ctx.site.get_many([loan['book'] for loan in loans]) return render_template("admin/loans", loans, None)
def POST(self): i = web.input(action=None) # Sanitize action = None actions = ['updateall'] if i.action in actions: action = i.action if action == 'updateall': borrow.update_all_loan_status() loans = borrow.get_all_loans() raise web.seeother(web.ctx.path) # Redirect to avoid form re-post on re-load
def GET(self): loans = borrow.get_all_loans() return render_template("admin/loans", loans, None)