Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

ticket 18337 - django.forms.BoundField should be injectable within django.forms.Form #77

Closed
wants to merge 1 commit into from

2 participants

Eamonn Faherty Luke Plant
Eamonn Faherty

In order to keep the label html in the BoundField? and the widget html 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

Eamonn Faherty 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
2933fad
Luke Plant
Owner

Closing for the reasons described in the ticket.

Luke Plant spookylukey closed this October 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 18, 2012
Eamonn Faherty 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
2933fad
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  django/forms/forms.py
5  django/forms/forms.py
@@ -74,7 +74,7 @@ class BaseForm(StrAndUnicode):
74 74
     # class, not to the Form class.
75 75
     def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
76 76
                  initial=None, error_class=ErrorList, label_suffix=':',
77  
-                 empty_permitted=False):
  77
+                 empty_permitted=False, bound_field_class=BoundField):
78 78
         self.is_bound = data is not None or files is not None
79 79
         self.data = data or {}
80 80
         self.files = files or {}
@@ -86,6 +86,7 @@ def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
86 86
         self.empty_permitted = empty_permitted
87 87
         self._errors = None # Stores the errors after clean() has been called.
88 88
         self._changed_data = None
  89
+        self.bound_field_class = bound_field_class
89 90
 
90 91
         # The base_fields class attribute is the *class-wide* definition of
91 92
         # fields. Because a particular *instance* of the class might want to
@@ -107,7 +108,7 @@ def __getitem__(self, name):
107 108
             field = self.fields[name]
108 109
         except KeyError:
109 110
             raise KeyError('Key %r not found in Form' % name)
110  
-        return BoundField(self, field, name)
  111
+        return bound_field_class(self, field, name)
111 112
 
112 113
     def _get_errors(self):
113 114
         "Returns an ErrorDict for the data provided for the form"
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.