﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22937	Allow configuring Form defaults (like label_suffix) on a per-project basis	Neal Todd	nobody	"Currently, the default for [https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.label_suffix Form.label_suffix] (a colon (:) in English) is hardcoded in [https://github.com/django/django/blob/master/django/forms/forms.py#L122 forms.py]. 

Although this default can be overridden in individual Form and Field instantiation, the hardcoding makes it difficult to globally set a different default label suffix across a whole project. A workaround such as having a base form that sets the attribute does work, but requires all the forms in a project to inherit from it rather than just from, e.g., forms.Form:

{{{
class BaseForm(forms.Form):
    def __init__(self, *args, **kwargs):
        kwargs.setdefault('label_suffix', '')
        super(BaseForm, self).__init__(*args, **kwargs)
}}}

[https://github.com/nealtodd/django/tree/label_suffix_setting This branch] pulls the default for Form.label_suffix out of forms.py and into a `django.conf.settings`.

It includes tests and documentation. All Django tests pass using `test_sqlite`.

It is backwards compatible as it is included in global settings with a default of ':'.

A typical use-case, and the reason for submitting this patch, is to use an empty string for the label suffix. Note in the implementation that there's special handling for that case because translating an empty string doesn't result in an empty string (because of the placement of the .po file version strings):

{{{
>>> from django.utils.translation import ugettext as _
>>> _('')
u'Project-Id-Version: Django\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2013-10-09 20:17+0200\nPO-Revision-Date: 2010-05-13 15:35+0200\nLast-Translator: Django team\nLanguage-Team: English <en@li.org>\nLanguage: en\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n'
}}}

Hope it'll be considered useful enough for a PR.

Regards, Neal"	New feature	closed	Forms	dev	Normal	wontfix			Accepted	1	0	0	1	0	0
