newforms: Small short-circuit optimization to BoundField.as_widget()

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-11-27 05:02:21 +00:00
parent 190c987e63
commit 7c1cc5fb25
1 changed files with 1 additions and 1 deletions

View File

@ -176,7 +176,7 @@ class BoundField(object):
def as_widget(self, widget, attrs=None): def as_widget(self, widget, attrs=None):
attrs = attrs or {} attrs = attrs or {}
auto_id = self.auto_id auto_id = self.auto_id
if not attrs.has_key('id') and not widget.attrs.has_key('id') and auto_id: if auto_id and not attrs.has_key('id') and not widget.attrs.has_key('id'):
attrs['id'] = auto_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._form.data.get(self._name, None), attrs=attrs)