def keyholder(): current_keyholder = User.query.join(User.keys).all() last_transaction = KeyTransaction.query.order_by(db.desc(KeyTransaction.start)).first() resp = jsonify( current_keyholder=[k.nick for k in current_keyholder if k.nick], ) resp.date = last_transaction.start resp.add_etag() resp.make_conditional(request) return resp
def key(key_id): query = KeyTransaction.query.filter(KeyTransaction.key_id==key_id) transactions = query.order_by(db.desc(KeyTransaction.start)).limit(50).all() key = Key.query.get(key_id) return render_template("key.html", key=key, transactions=transactions)