Index: django/newforms/forms.py
===================================================================
--- django/newforms/forms.py (revision 4057)
+++ django/newforms/forms.py (working copy)
@@ -3,7 +3,7 @@
"""
from fields import Field
-from widgets import TextInput, Textarea
+from widgets import TextInput, Textarea, Label
from util import ErrorDict, ErrorList, ValidationError
NON_FIELD_ERRORS = '__all__'
@@ -64,12 +64,12 @@
def as_table(self):
"Returns this form rendered as an HTML
."
- output = u'\n'.join(['%s: | %s |
' % (pretty_name(name), BoundField(self, field, name)) for name, field in self.fields.items()])
+ output = u'\n'.join(['%s: | %s |
' % BoundField(self, field, name).with_label() for name, field in self.fields.items()])
return '' % output
def as_ul(self):
"Returns this form rendered as an HTML ."
- output = u'\n'.join(['- %s: %s
' % (pretty_name(name), BoundField(self, field, name)) for name, field in self.fields.items()])
+ output = u'\n'.join(['- %s: %s
' % BoundField(self, field, name).with_label() for name, field in self.fields.items()])
return '' % output
def as_table_with_errors(self):
@@ -82,7 +82,7 @@
bf = BoundField(self, field, name)
if bf.errors:
output.append(' |
' % '\n'.join(['- %s
' % e for e in bf.errors]))
- output.append('%s: | %s |
' % (pretty_name(name), bf))
+ output.append('%s: | %s |
' % bf.with_label())
return '' % '\n'.join(output)
def as_ul_with_errors(self):
@@ -96,7 +96,7 @@
line = '- '
if bf.errors:
line += '' % '\n'.join(['
- %s
' % e for e in bf.errors])
- line += '%s: %s' % (pretty_name(name), bf)
+ line += '%s: %s' % bf.with_label()
output.append(line)
return '' % '\n'.join(output)
@@ -167,3 +167,14 @@
def as_textarea(self, attrs=None):
"Returns a string of HTML for representing this as a