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