From 9cd05b61d24ec5e064e3c27ea0fa5f150a7ff6ec Mon Sep 17 00:00:00 2001 From: Feliciaan De Palmenaer Date: Sun, 29 Mar 2015 13:01:42 +0200 Subject: [PATCH] flash messages --- app/templates/layout.html | 3 ++- app/views/order.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/templates/layout.html b/app/templates/layout.html index 0971737..bb72bb2 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -53,7 +53,8 @@ {% endblock %} {% block content -%} - {{ utils.flashed_messages() }} + {{ utils.flashed_messages(container=True) }} +
{% block container -%} {%- endblock %} diff --git a/app/views/order.py b/app/views/order.py index 81ff2b1..a57027d 100644 --- a/app/views/order.py +++ b/app/views/order.py @@ -74,6 +74,7 @@ def order_item_create(id): session['anon_name'] = item.name db.session.add(item) db.session.commit() + flash('Ordered %s' % (item.product.name), 'info') return redirect(url_for('.order', id=id)) return render_template('order_form.html', form=form, url=url_for(".order_item_create", id=id)) @@ -84,8 +85,10 @@ def delete_item(order_id, item_id): if not current_user.is_anonymous(): id = current_user.id if item.can_delete(order_id, id, session.get('anon_name', '')): + product_name = item.product.name db.session.delete(item) db.session.commit() + flash('Deleted %s' % product_name, 'info') return redirect(url_for('.order', id=order_id)) abort(404)