diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2007-05-15 03:37:41 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2007-05-15 03:37:41 +0000 |
| commit | 433659139596a75eab03940ea2029970de6ee287 (patch) | |
| tree | b4ee37f43df2d7a560a403a9d391c51702946772 /django/newforms/forms.py | |
| parent | 415e84ad53e0d0d8f7df87784c1893489bdbe0b8 (diff) | |
newforms-admin: Merged to [5243]. There are 3 failing tests in regressiontests.serializers_regress.tests.SerializerTests, but they fail in trunk also.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
| -rw-r--r-- | django/newforms/forms.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py index 42a06fd00d..0eec71a516 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -187,13 +187,13 @@ class BaseForm(StrAndUnicode): def full_clean(self): """ - Cleans all of self.data and populates self.__errors and self.clean_data. + Cleans all of self.data and populates self.__errors and self.cleaned_data. """ errors = ErrorDict() if not self.is_bound: # Stop further processing. self.__errors = errors return - self.clean_data = {} + self.cleaned_data = {} for name, field in self.fields.items(): # value_from_datadict() gets the data from the dictionary. # Each widget type knows how to retrieve its own data, because some @@ -201,18 +201,18 @@ class BaseForm(StrAndUnicode): value = field.widget.value_from_datadict(self.data, self.add_prefix(name)) try: value = field.clean(value) - self.clean_data[name] = value + self.cleaned_data[name] = value if hasattr(self, 'clean_%s' % name): value = getattr(self, 'clean_%s' % name)() - self.clean_data[name] = value + self.cleaned_data[name] = value except ValidationError, e: errors[name] = e.messages try: - self.clean_data = self.clean() + self.cleaned_data = self.clean() except ValidationError, e: errors[NON_FIELD_ERRORS] = e.messages if errors: - delattr(self, 'clean_data') + delattr(self, 'cleaned_data') self.__errors = errors def clean(self): @@ -222,7 +222,7 @@ class BaseForm(StrAndUnicode): not be associated with a particular field; it will have a special-case association with the field named '__all__'. """ - return self.clean_data + return self.cleaned_data class Form(BaseForm): "A collection of Fields, plus their associated data." @@ -273,6 +273,8 @@ class BoundField(StrAndUnicode): attrs['id'] = auto_id if not self.form.is_bound: data = self.form.initial.get(self.name, self.field.initial) + if callable(data): + data = data() else: data = self.data return widget.render(self.html_name, data, attrs=attrs) |
