From 0c4f67c51846815fbd080ded7de740f57fcde506 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Thu, 3 Jun 2021 23:46:25 +0530 Subject: moved flash form function --- app/misc_func.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/misc_func.py (limited to 'app/misc_func.py') diff --git a/app/misc_func.py b/app/misc_func.py new file mode 100644 index 0000000..11e2bb2 --- /dev/null +++ b/app/misc_func.py @@ -0,0 +1,9 @@ +from flask import flash + +def flash_errors(form): + for field, errors in form.errors.items(): + for error in errors: + flash(u"Error in the %s field - %s" % ( + getattr(form, field).label.text, + error + ), 'danger') \ No newline at end of file -- cgit v1.2.3