serve: Add ?unsorted flag to /transactions
This commit is contained in:
parent
f3bdd475bc
commit
d505ec7ade
1 changed files with 7 additions and 2 deletions
9
serve.py
9
serve.py
|
@ -42,7 +42,12 @@ def delete_category(name):
|
||||||
|
|
||||||
@route("/transactions")
|
@route("/transactions")
|
||||||
def 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()
|
categories = session.query(Category).all()
|
||||||
childs = [c for c in categories if c.is_child()]
|
childs = [c for c in categories if c.is_child()]
|
||||||
return template("transactions", transactions=transactions, categories=childs)
|
return template("transactions", transactions=transactions, categories=childs)
|
||||||
|
@ -66,4 +71,4 @@ def buksort():
|
||||||
def command(profile):
|
def command(profile):
|
||||||
global session
|
global session
|
||||||
session = get_session(profile)
|
session = get_session(profile)
|
||||||
run(host="localhost", port=8080, reloader=True, debug=True)
|
run(host="0.0.0.0", port=8080, reloader=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue