diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-12-13 23:03:19 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-12-13 23:03:19 +0000 |
| commit | d8a21981b70770e536236acfbc4c87f48b587661 (patch) | |
| tree | 2e1f73d72ebfe05504e5afcd4da2b616207e830e /django/newforms/forms.py | |
| parent | 10edce12fc05fb31610f1ee4a372cd7c0b388533 (diff) | |
Fixed #3139 -- newforms BoundField no longer returns empty errors when using a prefix. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
| -rw-r--r-- | django/newforms/forms.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py index 0c5219dfe2..d492ebeb0f 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -173,7 +173,8 @@ class BoundField(StrAndUnicode): def __init__(self, form, field, name): self.form = form self.field = field - self.name = form.add_prefix(name) + self.name = name + self.html_name = form.add_prefix(name) self.label = self.field.label or pretty_name(name) def __unicode__(self): @@ -201,7 +202,7 @@ class BoundField(StrAndUnicode): 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.data, attrs=attrs) + return widget.render(self.html_name, self.data, attrs=attrs) def as_text(self, attrs=None): """ @@ -222,8 +223,8 @@ class BoundField(StrAndUnicode): def _data(self): "Returns the data for this BoundField, or None if it wasn't given." if self.field.widget.requires_data_list and isinstance(self.form.data, MultiValueDict): - return self.form.data.getlist(self.name) - return self.form.data.get(self.name, None) + return self.form.data.getlist(self.html_name) + return self.form.data.get(self.html_name, None) data = property(_data) def label_tag(self, contents=None): @@ -251,8 +252,8 @@ class BoundField(StrAndUnicode): """ auto_id = self.form.auto_id if auto_id and '%s' in str(auto_id): - return str(auto_id) % self.name + return str(auto_id) % self.html_name elif auto_id: - return self.name + return self.html_name return '' auto_id = property(_auto_id) |
