flash messages

This commit is contained in:
Feliciaan De Palmenaer 2015-03-29 13:01:42 +02:00
parent b9a1a62a81
commit 9cd05b61d2
2 changed files with 5 additions and 1 deletions

View file

@ -53,7 +53,8 @@
{% endblock %}
{% block content -%}
{{ utils.flashed_messages() }}
{{ utils.flashed_messages(container=True) }}
<div class="container">
{% block container -%}
{%- endblock %}

View file

@ -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)