Example #1
0
def edit_transaction(id):
    transaction = transaction_repository.select(id)
    merchants = merchant_repository.select_all()
    tags = tag_repository.select_all()
    return render_template("transactions/edit.html",
                           transaction=transaction,
                           merchants=merchants,
                           tags=tags)
Example #2
0
def edit_transaction(id):
    transaction = transaction_repository.select(id)
    merchants = merchant_repository.select_all()
    categorys = category_repository.select_all()
    users = user_repository.select_all()
    return render_template("transactions/edit.html",
                           transaction=transaction,
                           merchants=merchants,
                           categorys=categorys,
                           users=users)
Example #3
0
def update_transaction(id):
    transaction = transaction_repository.select(id)
    user = user_repository.select(transaction.user.id)
    amount = request.form['amount']
    merchant = merchant_repository.select(request.form['merchant'])
    tag = tag_repository.select(request.form['tag'])
    updated_transaction = Transaction(amount, user, merchant, tag, transaction.id)
    transaction_repository.update(updated_transaction)
    transactions = user_repository.select_transactions(user)
    tags = tag_repository.select_all()
    total = 0
    for transaction in transactions:
        total += transaction.amount
    return render_template("/users/dashboard.html", user = user, transactions = transactions, total = total, tags = tags)
Example #4
0
def show_transaction(id):
    transaction = transaction_repository.select(id)
    return render_template("transactions/show.html", transaction=transaction)