diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-03-30 12:11:05 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-04-21 07:50:43 -0400 |
| commit | 50dddbdfc7489847d55465ad352fc3278b2a9a08 (patch) | |
| tree | c7f235ed0e6b14ee6f9ee71c2802d42b1f15f77c /django/forms | |
| parent | 0dad0ca55ec6081d3e92ac8340ed9f8d5c65a606 (diff) | |
[1.7.x] Corrected many style guide violations that the newest version of flake8 catches
Backport of 778ce245dd466bce1b19f89e52cf9ed8f1b46513 from master
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/formsets.py | 2 | ||||
| -rw-r--r-- | django/forms/models.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py index d5600867e1..9c4c7b5b9a 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -153,7 +153,7 @@ class BaseFormSet(object): if self.is_bound: defaults['data'] = self.data defaults['files'] = self.files - if self.initial and not 'initial' in kwargs: + if self.initial and 'initial' not in kwargs: try: defaults['initial'] = self.initial[i] except IndexError: diff --git a/django/forms/models.py b/django/forms/models.py index 6a3dc62342..5b799fe694 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -46,7 +46,7 @@ def construct_instance(form, instance, fields=None, exclude=None): file_field_list = [] for f in opts.fields: if not f.editable or isinstance(f, models.AutoField) \ - or not f.name in cleaned_data: + or f.name not in cleaned_data: continue if fields is not None and f.name not in fields: continue @@ -130,7 +130,7 @@ def model_to_dict(instance, fields=None, exclude=None): for f in opts.concrete_fields + opts.virtual_fields + opts.many_to_many: if not getattr(f, 'editable', False): continue - if fields and not f.name in fields: + if fields and f.name not in fields: continue if exclude and f.name in exclude: continue @@ -189,7 +189,7 @@ def fields_for_model(model, fields=None, exclude=None, widgets=None, for f in sorted(opts.concrete_fields + sortable_virtual_fields + opts.many_to_many): if not getattr(f, 'editable', False): continue - if fields is not None and not f.name in fields: + if fields is not None and f.name not in fields: continue if exclude and f.name in exclude: continue @@ -663,7 +663,7 @@ class BaseModelFormSet(BaseFormSet): # Reduce Model instances to their primary key values row_data = tuple(d._get_pk_val() if hasattr(d, '_get_pk_val') else d for d in row_data) - if row_data and not None in row_data: + if row_data and None not in row_data: # if we've already seen it then we have a uniqueness failure if row_data in seen_data: # poke error messages into the right places and mark |
