Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9854 closed (duplicate)

A more flexible help_text proposal

Reported by: h3 Owned by: nobody
Component: Forms Version: 1.0
Severity: Keywords: help_text
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This is not really a bug, but rather a enhancement proposal for recurring annoyance I have with every django projects I work with (quite a lot).

Every time I have to theme a django generated form I end up having to override forms rendering methods in order to wrap the help text with a span.
Without that span, applying CSS styling is awkward, counter-productive and semantically questionable.


class SomeForm(forms.ModelForm):
     def as_ul(self):
        return self._html_output(u'<li>%(errors)s%(label)s %(field)s<span class="help">%(help_text)s</span></li>', u'<li>%s</li>', '</li>', u' %s', False)           

It's far from optimal, require too much code and make it quite hard to work with externals applications (svn).

So here's my proposal:

FORM_HELP_TEXT_HTML = '<span class="help">%s</span>'

That way it makes it easy to apply it site-wide without having to modify every forms class of each applications.

I've included a patch, it's quite a minor tweak and the default behavior is not changed at all.

Thanks for considering my proposal.

Attachments (1)

django-form-patch.diff (1.9 KB) - added by h3 7 years ago.
Allow FORM_HELP_TEXT_HTML to be specified site-wite in

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by h3

Allow FORM_HELP_TEXT_HTML to be specified site-wite in

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Dupe of #8426.

comment:2 Changed 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top