From 4a85a75fb0e3185dc77362c16e80219dac168c05 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 15 Feb 2007 22:43:43 +0000 Subject: [PATCH] Fixed #3506 -- Changed newforms BoundField.help_text to an empty string if None. Thanks for the patch, Thomas Steinacher git-svn-id: http://code.djangoproject.com/svn/django/trunk@4528 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/forms.py | 2 +- tests/regressiontests/forms/tests.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django/newforms/forms.py b/django/newforms/forms.py index c5e4513f9c..e9cf4ca11c 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -218,7 +218,7 @@ class BoundField(StrAndUnicode): self.label = pretty_name(name) else: self.label = self.field.label - self.help_text = field.help_text + self.help_text = field.help_text or '' def __unicode__(self): "Renders this field as an HTML widget." diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index 5bd56109a1..c53729da46 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -3044,6 +3044,8 @@ does not have help text, nothing will be output.

Password2:

+>>> Template('{{ form.password1.help_text }}').render(Context({'form': UserRegistration(auto_id=False)})) +'' The label_tag() method takes an optional attrs argument: a dictionary of HTML attributes to add to the