Opened 16 years ago

Closed 16 years ago

Last modified 16 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: no UI/UX: no

Description

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.

Example:

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.

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

by h3, 16 years ago

Attachment: django-form-patch.diff added

Allow FORM_HELP_TEXT_HTML to be specified site-wite in settings.py

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: duplicate
Status: newclosed

Dupe of #8426.

comment:2 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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