Ticket #3506: help_text.patch

File help_text.patch, 1.0 KB (added by Thomas Steinacher <tom@…>, 18 years ago)
  • django/newforms/forms.py

     
    218218            self.label = pretty_name(name)
    219219        else:
    220220            self.label = self.field.label
    221         self.help_text = field.help_text
     221        self.help_text = field.help_text or ''
    222222
    223223    def __unicode__(self):
    224224        "Renders this field as an HTML widget."
  • tests/regressiontests/forms/tests.py

     
    30443044<p>Password2: <input type="password" name="password2" /></p>
    30453045<input type="submit" />
    30463046</form>
     3047>>> Template('{{ form.password1.help_text }}').render(Context({'form': UserRegistration(auto_id=False)}))
     3048''
    30473049
    30483050The label_tag() method takes an optional attrs argument: a dictionary of HTML
    30493051attributes to add to the <label> tag.
Back to Top