A more flexible help_text proposal
|Reported by:||h3||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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:
# settings.py 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 form.py behavior is not changed at all.
Thanks for considering my proposal.