serve: Add ?unsorted flag to /transactions

This commit is contained in:
Felix Breidenstein 2020-03-29 23:55:33 +02:00
parent f3bdd475bc
commit d505ec7ade

View file

@ -42,7 +42,12 @@ def delete_category(name):
@route("/transactions")
def transactions():
transactions = session.query(Transaction).all()
if request.GET.get("unsorted", None):
print("Unsorted")
transactions = session.query(Transaction).filter(Transaction.category_id == None).all()
else:
print("all")
transactions = session.query(Transaction).all()
categories = session.query(Category).all()
childs = [c for c in categories if c.is_child()]
return template("transactions", transactions=transactions, categories=childs)
@ -66,4 +71,4 @@ def buksort():
def command(profile):
global session
session = get_session(profile)
run(host="localhost", port=8080, reloader=True, debug=True)
run(host="0.0.0.0", port=8080, reloader=True)