From 574ac4123929099119cbdfc94420af16ccf2be19 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 7 Feb 2022 14:52:17 +0100 Subject: [PATCH] Render messages on base_site.html & add new action message --- ereuse_devicehub/inventory/views.py | 6 ++++-- .../templates/ereuse_devicehub/base_site.html | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index bd52eb77..3f6640aa 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -1,10 +1,9 @@ -import datetime - import flask from flask import Blueprint, request, url_for from flask.views import View from flask_login import current_user, login_required +from ereuse_devicehub import messages from ereuse_devicehub.inventory.forms import (AllocateForm, LotDeviceForm, LotForm, NewActionForm, NewDeviceForm, TagDeviceForm, @@ -303,6 +302,9 @@ class NewActionView(View): if self.form.validate_on_submit(): self.form.save() + + # TODO(@slamora): include details of created action + messages.success('Action created!') return flask.redirect(next_url) diff --git a/ereuse_devicehub/templates/ereuse_devicehub/base_site.html b/ereuse_devicehub/templates/ereuse_devicehub/base_site.html index 99cf0cf5..b0baf853 100644 --- a/ereuse_devicehub/templates/ereuse_devicehub/base_site.html +++ b/ereuse_devicehub/templates/ereuse_devicehub/base_site.html @@ -175,6 +175,15 @@
+ {% block messages %} + {% for message in session['_messages'] %} + + {% endfor %} + {% endblock %} {% block main %} {% endblock main %}