Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed scaffolder missing bound field errors output

  • Loading branch information...
commit afbf638f86b4ac227af5c5344c96e83c4e835473 1 parent 72c1ec2
@1stvamp authored
Showing with 3 additions and 0 deletions.
  1. +1 −0  dfs/management/commands/formscaffold.py
  2. +2 −0  dfs/scaffold.py
View
1  dfs/management/commands/formscaffold.py
@@ -28,3 +28,4 @@ def handle(self, *args, **options):
scaffolder = getattr(scaffold, output_type)
form = getattr(do_import(module_path), form_name)
self.stdout.write(scaffolder(cls=form))
+ self.stdout.write("\n")
View
2  dfs/scaffold.py
@@ -1,5 +1,6 @@
from django.utils.encoding import force_unicode
from django.forms.forms import BoundField
+from django.utils.html import conditional_escape
def as_p(instance=None, cls=None):
@@ -86,6 +87,7 @@ def html_output(form, normal_row, error_row, row_ender, help_text_html, errors_o
for name, field in form.fields.items():
html_class_attr = ''
bf = BoundField(form, field, name)
+ bf_errors = form.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable.
if bf.is_hidden:
if bf_errors:
top_errors.extend([u'(Hidden field %s) %s' % (name, force_unicode(e)) for e in bf_errors])
Please sign in to comment.
Something went wrong with that request. Please try again.