=== modified file 'django/forms/forms.py'
--- django/forms/forms.py 2008-08-11 13:23:01 +0000
+++ django/forms/forms.py 2008-08-11 13:51:36 +0000
@@ -70,6 +70,7 @@
# class, not to the Form class.
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
initial=None, error_class=ErrorList, label_suffix=':',
+ label_template='',
empty_permitted=False):
self.is_bound = data is not None or files is not None
self.data = data or {}
@@ -79,6 +80,7 @@
self.initial = initial or {}
self.error_class = error_class
self.label_suffix = label_suffix
+ self.label_template = label_template
self.empty_permitted = empty_permitted
self._errors = None # Stores the errors after clean() has been called.
self._changed_data = None
@@ -374,7 +376,11 @@
id_ = widget.attrs.get('id') or self.auto_id
if id_:
attrs = attrs and flatatt(attrs) or ''
- contents = u'' % (widget.id_for_label(id_), attrs, unicode(contents))
+ contents = self.form.label_template % {
+ 'id': widget.id_for_label(id_),
+ 'attrs': attrs,
+ 'contents': unicode(contents)
+ }
return mark_safe(contents)
def _is_hidden(self):
=== modified file 'django/forms/models.py'
--- django/forms/models.py 2008-08-10 21:10:47 +0000
+++ django/forms/models.py 2008-08-11 13:52:22 +0000
@@ -186,6 +186,7 @@
class BaseModelForm(BaseForm):
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
initial=None, error_class=ErrorList, label_suffix=':',
+ label_template='',
empty_permitted=False, instance=None):
opts = self._meta
if instance is None:
@@ -199,7 +200,7 @@
if initial is not None:
object_data.update(initial)
super(BaseModelForm, self).__init__(data, files, auto_id, prefix, object_data,
- error_class, label_suffix, empty_permitted)
+ error_class, label_suffix, label_template, empty_permitted)
def clean(self):
self.validate_unique()