mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
newforms: Added BoundField.data property
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -182,7 +182,7 @@ class BoundField(object):
|
||||
auto_id = self.auto_id
|
||||
if auto_id and not attrs.has_key('id') and not widget.attrs.has_key('id'):
|
||||
attrs['id'] = auto_id
|
||||
return widget.render(self._name, self._form.data.get(self._name, None), attrs=attrs)
|
||||
return widget.render(self._name, self.data, attrs=attrs)
|
||||
|
||||
def as_text(self, attrs=None):
|
||||
"""
|
||||
@@ -194,6 +194,11 @@ class BoundField(object):
|
||||
"Returns a string of HTML for representing this as a <textarea>."
|
||||
return self.as_widget(Textarea(), attrs)
|
||||
|
||||
def _data(self):
|
||||
"Returns the data for this BoundField, or None if it wasn't given."
|
||||
return self._form.data.get(self._name, None)
|
||||
data = property(_data)
|
||||
|
||||
def _verbose_name(self):
|
||||
return pretty_name(self._name)
|
||||
verbose_name = property(_verbose_name)
|
||||
|
||||
Reference in New Issue
Block a user