@@ -172,13 +172,11 @@ def _validate(cls, model):
172172 for idx , inline in enumerate (cls .inlines ):
173173 if not issubclass (inline , BaseDocumentAdmin ):
174174 raise ImproperlyConfigured (
175- "'%s.inlines[%d]' does not inherit "
176- "from BaseModelAdmin." % (cls .__name__ , idx )
175+ "'%s.inlines[%d]' does not inherit from BaseModelAdmin." % (cls .__name__ , idx )
177176 )
178177 if not inline .document :
179178 raise ImproperlyConfigured (
180- "'document' is a required attribute "
181- "of '%s.inlines[%d]'." % (cls .__name__ , idx )
179+ "'document' is a required attribute of '%s.inlines[%d]'." % (cls .__name__ , idx )
182180 )
183181 if not issubclass (inline .document , BaseDocument ):
184182 raise ImproperlyConfigured (
@@ -195,7 +193,7 @@ def validate_inline(cls, parent, parent_model):
195193 f = get_field (cls , cls .model , cls .model ._meta , "fk_name" , cls .fk_name )
196194 if not isinstance (f , models .ForeignKey ):
197195 raise ImproperlyConfigured (
198- "'%s.fk_name is not an instance of " " models.ForeignKey." % cls .__name__
196+ "'%s.fk_name is not an instance of models.ForeignKey." % cls .__name__
199197 )
200198
201199 if not issubclass (cls , EmbeddedDocumentAdmin ):
@@ -217,7 +215,7 @@ def validate_inline(cls, parent, parent_model):
217215 # formset
218216 if hasattr (cls , "formset" ) and not issubclass (cls .formset , BaseDocumentFormSet ):
219217 raise ImproperlyConfigured (
220- "'%s.formset' does not inherit from " " BaseDocumentFormSet." % cls .__name__
218+ "'%s.formset' does not inherit from BaseDocumentFormSet." % cls .__name__
221219 )
222220
223221 # exclude
@@ -285,8 +283,7 @@ def validate_base(cls, model):
285283 check_isseq (cls , "fieldsets[%d]" % idx , fieldset )
286284 if len (fieldset ) != 2 :
287285 raise ImproperlyConfigured (
288- "'%s.fieldsets[%d]' does not "
289- "have exactly two elements." % (cls .__name__ , idx )
286+ "'%s.fieldsets[%d]' does not have exactly two elements." % (cls .__name__ , idx )
290287 )
291288 check_isdict (cls , "fieldsets[%d][1]" % idx , fieldset [1 ])
292289 if "fields" not in fieldset [1 ]:
@@ -297,7 +294,7 @@ def validate_base(cls, model):
297294 for fields in fieldset [1 ]["fields" ]:
298295 # The entry in fields might be a tuple. If it is a standalone
299296 # field, make it into a tuple to make processing easier.
300- if type (fields ) != tuple :
297+ if not isinstance (fields , tuple ) :
301298 fields = (fields ,)
302299 for field in fields :
303300 if field in cls .readonly_fields :
@@ -347,7 +344,7 @@ def validate_base(cls, model):
347344 issubclass (cls .form , BaseModelForm )
348345 or cls .form .__class__ .__name__ == "DocumentFormMetaclass"
349346 ):
350- raise ImproperlyConfigured ("%s.form does not inherit from " " BaseModelForm." % cls .__name__ )
347+ raise ImproperlyConfigured ("%s.form does not inherit from BaseModelForm." % cls .__name__ )
351348
352349 # filter_vertical
353350 if hasattr (cls , "filter_vertical" ):
@@ -356,7 +353,7 @@ def validate_base(cls, model):
356353 f = get_field (cls , model , opts , "filter_vertical" , field )
357354 if not isinstance (f , models .ManyToManyField ):
358355 raise ImproperlyConfigured (
359- "'%s.filter_vertical[%d]' must be " " a ManyToManyField." % (cls .__name__ , idx )
356+ "'%s.filter_vertical[%d]' must be a ManyToManyField." % (cls .__name__ , idx )
360357 )
361358
362359 # filter_horizontal
@@ -366,7 +363,7 @@ def validate_base(cls, model):
366363 f = get_field (cls , model , opts , "filter_horizontal" , field )
367364 if not isinstance (f , ListField ) and not isinstance (f .field , ReferenceField ):
368365 raise ImproperlyConfigured (
369- "'%s.filter_horizontal[%d]' must be " " a ManyToManyField." % (cls .__name__ , idx )
366+ "'%s.filter_horizontal[%d]' must be a ManyToManyField." % (cls .__name__ , idx )
370367 )
371368
372369 # radio_fields
0 commit comments