diff options
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/fields.py | 4 | ||||
| -rw-r--r-- | django/forms/formsets.py | 6 | ||||
| -rw-r--r-- | django/forms/models.py | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 56d0e316f2..6f88fb2662 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -1102,8 +1102,8 @@ class FilePathField(ChoiceField): continue full_file = os.path.join(self.path, f) if (((self.allow_files and os.path.isfile(full_file)) or - (self.allow_folders and os.path.isdir(full_file))) and - (self.match is None or self.match_re.search(f))): + (self.allow_folders and os.path.isdir(full_file))) and + (self.match is None or self.match_re.search(f))): self.choices.append((full_file, f)) except OSError: pass diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 3759d3381d..fd1fd92773 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -325,15 +325,15 @@ class BaseFormSet(object): self._errors.append(form.errors) try: if (self.validate_max and - self.total_form_count() - len(self.deleted_forms) > self.max_num) or \ - self.management_form.cleaned_data[TOTAL_FORM_COUNT] > self.absolute_max: + self.total_form_count() - len(self.deleted_forms) > self.max_num) or \ + self.management_form.cleaned_data[TOTAL_FORM_COUNT] > self.absolute_max: raise ValidationError(ungettext( "Please submit %d or fewer forms.", "Please submit %d or fewer forms.", self.max_num) % self.max_num, code='too_many_forms', ) if (self.validate_min and - self.total_form_count() - len(self.deleted_forms) < self.min_num): + self.total_form_count() - len(self.deleted_forms) < self.min_num): raise ValidationError(ungettext( "Please submit %d or more forms.", "Please submit %d or more forms.", self.min_num) % self.min_num, diff --git a/django/forms/models.py b/django/forms/models.py index e9bd338064..b14ea7a265 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -524,7 +524,7 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None, # be difficult to debug for code that needs updating, so we produce the # warning here too. if (getattr(Meta, 'fields', None) is None and - getattr(Meta, 'exclude', None) is None): + getattr(Meta, 'exclude', None) is None): warnings.warn("Calling modelform_factory without defining 'fields' or " "'exclude' explicitly is deprecated", DeprecationWarning, stacklevel=2) @@ -675,7 +675,7 @@ class BaseModelFormSet(BaseFormSet): for form in valid_forms: # see if we have data for both fields if (form.cleaned_data and form.cleaned_data[field] is not None - and form.cleaned_data[unique_for] is not None): + and form.cleaned_data[unique_for] is not None): # if it's a date lookup we need to get the data for all the fields if lookup == 'date': date = form.cleaned_data[unique_for] @@ -815,7 +815,7 @@ def modelformset_factory(model, form=ModelForm, formfield_callback=None, if meta is None: meta = type(str('Meta'), (object,), {}) if (getattr(meta, 'fields', fields) is None and - getattr(meta, 'exclude', exclude) is None): + getattr(meta, 'exclude', exclude) is None): warnings.warn("Calling modelformset_factory without defining 'fields' or " "'exclude' explicitly is deprecated", DeprecationWarning, stacklevel=2) |
