diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
| commit | ca33d307dee3cf68cc9cd2ccfae00c7ff23ea890 (patch) | |
| tree | e0f0afa392f4ab50de4a89e2a0b1b4cc53f40794 /django/newforms/forms.py | |
| parent | 7325fbf4ff20f9b0f21d3a1aba1abaca78a765d7 (diff) | |
queryset-refactor: Merged to [6300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
| -rw-r--r-- | django/newforms/forms.py | 10 |
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 |
