summaryrefslogtreecommitdiff
path: root/django/newforms/forms.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2008-01-17 18:12:24 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2008-01-17 18:12:24 +0000
commitdaa467d79ec7b40e376294eabc51222a67690181 (patch)
treea91a72f3c10e95bf5c59a2599c0d370ddc8c78dc /django/newforms/forms.py
parentc080e441f347ad252be5e2d4dc56e9f43fce88cc (diff)
newforms-admin: Merged from trunk up to [7021].
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
-rw-r--r--django/newforms/forms.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index 88d5f8b3df..9e1b576710 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -9,7 +9,7 @@ from django.utils.html import escape
from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode
from django.utils.safestring import mark_safe
-from fields import Field
+from fields import Field, FileField
from widgets import Media, media_property, TextInput, Textarea
from util import flatatt, ErrorDict, ErrorList, ValidationError
@@ -205,7 +205,11 @@ class BaseForm(StrAndUnicode):
# widgets split data over several HTML fields.
value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
try:
- value = field.clean(value)
+ if isinstance(field, FileField):
+ initial = self.initial.get(name, field.initial)
+ value = field.clean(value, initial)
+ else:
+ value = field.clean(value)
self.cleaned_data[name] = value
if hasattr(self, 'clean_%s' % name):
value = getattr(self, 'clean_%s' % name)()