[damned-lies] Better error highlighting in vertimus action form



commit a0afcc894e73bfb8ba07548b014c115fde4eafb4
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Sep 6 08:55:39 2019 +0200

    Better error highlighting in vertimus action form

 vertimus/templatetags/vertimus.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/vertimus/templatetags/vertimus.py b/vertimus/templatetags/vertimus.py
index bca4588b..63c72d64 100644
--- a/vertimus/templatetags/vertimus.py
+++ b/vertimus/templatetags/vertimus.py
@@ -24,7 +24,9 @@ def as_tr(field):
         errors_html = ''.join(["%s" % err for err in field.errors])
 
     return format_html(
-        '<tr class="tr_{}"><th>{}</th><td>{}{}{}{}</td></tr>',
+        '<tr class="tr_{}"><th>{}</th><td>' +
+        ('<div class="errornote error">{}</div>' if errors_html else '') +
+        '{}{}{}</td></tr>',
         field.name, field.label_tag(), errors_html, field.as_widget(), help_link, help_html
     )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]