Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

In order to keep the label html in the BoundField? and the widget htm…

…l in the widget and to allow a mechanism for adding wrapping html to a field widget it would seem elegant to allow access to BoundField? by making BoundField? an overridable property in the django.forms.BaseForm? class in the same way the widget property is overridable in the Field class.


https://code.djangoproject.com/ticket/18337
  • Loading branch information...
commit 2933fadb47e86d361eba3137edfbdd6bfd1e3b00 1 parent 7495730
@eamonnfaherty authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/forms/forms.py
View
5 django/forms/forms.py
@@ -74,7 +74,7 @@ class BaseForm(StrAndUnicode):
# 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=':',
- empty_permitted=False):
+ empty_permitted=False, bound_field_class=BoundField):
self.is_bound = data is not None or files is not None
self.data = data or {}
self.files = files or {}
@@ -86,6 +86,7 @@ def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
self.empty_permitted = empty_permitted
self._errors = None # Stores the errors after clean() has been called.
self._changed_data = None
+ self.bound_field_class = bound_field_class
# The base_fields class attribute is the *class-wide* definition of
# fields. Because a particular *instance* of the class might want to
@@ -107,7 +108,7 @@ def __getitem__(self, name):
field = self.fields[name]
except KeyError:
raise KeyError('Key %r not found in Form' % name)
- return BoundField(self, field, name)
+ return bound_field_class(self, field, name)
def _get_errors(self):
"Returns an ErrorDict for the data provided for the form"
Please sign in to comment.
Something went wrong with that request. Please try again.