From 3b28a5e7077dfac9e556ce17fc5c99442ac172ed Mon Sep 17 00:00:00 2001 From: Swen Kooij Date: Mon, 26 Jun 2017 11:33:25 +0300 Subject: [PATCH] Fix PEP8 violations --- .gitignore | 1 + localized_fields/admin.py | 1 - localized_fields/forms.py | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 252625b..0a7bf2a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ env/ # Ignore Python byte code cache *.pyc __pycache__ +.cache/ # Ignore coverage reports .coverage diff --git a/localized_fields/admin.py b/localized_fields/admin.py index 98597ea..faa7611 100644 --- a/localized_fields/admin.py +++ b/localized_fields/admin.py @@ -5,7 +5,6 @@ from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \ LocalizedFileField - FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = { LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget}, LocalizedCharField: {'widget': widgets.AdminLocalizedCharFieldWidget}, diff --git a/localized_fields/forms.py b/localized_fields/forms.py index 4e4d2c5..c227ba3 100644 --- a/localized_fields/forms.py +++ b/localized_fields/forms.py @@ -88,7 +88,7 @@ class LocalizedFileFieldForm(LocalizedFieldForm, forms.FileField): def clean(self, value, initial=None): """ - Most part of this method is a copy of + Most part of this method is a copy of django.forms.MultiValueField.clean, with the exception of initial value handling (this need for correct processing FileField's). All original comments saved. @@ -121,8 +121,9 @@ class LocalizedFileFieldForm(LocalizedFieldForm, forms.FileField): field_initial = initial[i] except IndexError: field_initial = None + if field_value in self.empty_values and \ - field_initial in self.empty_values: + field_initial in self.empty_values: if self.require_all_fields: # Raise a 'required' error if the MultiValueField is # required and any field is empty.