summaryrefslogtreecommitdiff
path: root/django/newforms/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/newforms/forms.py')
-rw-r--r--django/newforms/forms.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index ab8729be65..2b1caddeda 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -212,6 +212,16 @@ class BaseForm(StrAndUnicode):
"""
return self.cleaned_data
+ def is_multipart(self):
+ """
+ Returns True if the form needs to be multipart-encrypted, i.e. it has
+ FileInput. Otherwise, False.
+ """
+ for field in self.fields.values():
+ if field.widget.needs_multipart_form:
+ return True
+ return False
+
class Form(BaseForm):
"A collection of Fields, plus their associated data."
# This is a separate class from BaseForm in order to abstract the way