summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-12-26 23:33:20 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-12-26 23:33:20 +0000
commitd0fcef9db0f53ef84535694f4fbcb135f0648e24 (patch)
treefdd80eedba2c06acecfc9c4f14b8b5589e450167 /django
parent30c2bffe17c46a1f599b3e5cf0bfcfd164f203fc (diff)
newforms: A label can now be the empty string, in which case a label won't be displayed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/newforms/forms.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index 95d81062f0..201cce3868 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -99,7 +99,8 @@ class BaseForm(StrAndUnicode):
else:
if errors_on_separate_row and bf_errors:
output.append(error_row % bf_errors)
- output.append(normal_row % {'errors': bf_errors, 'label': bf.label_tag(escape(bf.label+':')), 'field': bf})
+ label = bf.label and bf.label_tag(escape(bf.label + ':')) or ''
+ output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': bf})
if top_errors:
output.insert(0, error_row % top_errors)
if hidden_fields: # Insert any hidden fields in the last row.
@@ -187,7 +188,10 @@ class BoundField(StrAndUnicode):
self.field = field
self.name = name
self.html_name = form.add_prefix(name)
- self.label = self.field.label or pretty_name(name)
+ if self.field.label is None:
+ self.label = pretty_name(name)
+ else:
+ self.label = self.field.label
def __unicode__(self):
"Renders this field as an HTML widget."