def transactions(account): source = Account.get(account) form = TransactionForm(request.form) if form.validate(): target = Account.get(form.b.data) # TODO: store dates in UTC date = datetime.strptime(form.date.data, '%Y-%m-%d') increase = float(form.increase.data) decrease = float(form.decrease.data) description = form.description.data amount = increase - decrease transaction = api.transactions.create(source, target, date, amount, description) app.logger.debug(transaction) # TODO: return a JSON representation of the transaction? for e in form.errors: app.logger.debug('%s: %s' % (e, form.errors[e])) # TODO: return an error return render('accounts/view.html', account=source)
def view(account): account = Account.get(account) return render('accounts/view.html', account=account)