aboutsummaryrefslogtreecommitdiff
path: root/app/misc_func.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-03 23:46:25 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-03 23:46:25 +0530
commit0c4f67c51846815fbd080ded7de740f57fcde506 (patch)
tree1edb22fffdfba7222798c76d2a004c364396c390 /app/misc_func.py
parent53ae62ef3f206907f89aa3088b83b638b59e6de5 (diff)
moved flash form function
Diffstat (limited to 'app/misc_func.py')
-rw-r--r--app/misc_func.py9
1 files changed, 9 insertions, 0 deletions
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