After editing transaction, redirect back to previous page

This commit is contained in:
RunasSudo 2023-05-28 13:02:12 +10:00
parent a8ec41b2f2
commit a3ef647a2d
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,7 @@ def journal_edit_transaction():
db.session.delete(reconciliation)
db.session.commit()
return redirect(url_for('journal'))
return redirect(request.form.get('referrer', '') or url_for('journal'))
# Edit transaction
transaction.dt = datetime.strptime(request.form['dt'], '%Y-%m-%d')
@ -121,7 +121,7 @@ def journal_edit_transaction():
db.session.commit()
return redirect(url_for('journal'))
return redirect(request.form.get('referrer', '') or url_for('journal'))
@app.route('/balance-assertions')
def balance_assertions():

View File

@ -125,6 +125,8 @@
{% endif %}
<button type="submit" class="btn btn-primary ms-auto">Save</button>
</div>
<input type="hidden" name="referrer" value="{{ request.referrer or '' }}">
</form>
{% endblock %}