mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
Merge multiple isinstance() calls to one (#6481)
https://docs.python.org/3/library/functions.html#isinstance > If classinfo is a tuple of type objects (or recursively, other such > tuples), return true if object is an instance of any of the types.
This commit is contained in:
parent
31bf597081
commit
a216d02ce0
|
@ -1660,7 +1660,7 @@ class ListField(Field):
|
|||
"""
|
||||
if html.is_html_input(data):
|
||||
data = html.parse_html_list(data, default=[])
|
||||
if isinstance(data, type('')) or isinstance(data, Mapping) or not hasattr(data, '__iter__'):
|
||||
if isinstance(data, (type(''), Mapping)) or not hasattr(data, '__iter__'):
|
||||
self.fail('not_a_list', input_type=type(data).__name__)
|
||||
if not self.allow_empty and len(data) == 0:
|
||||
self.fail('empty')
|
||||
|
|
Loading…
Reference in New Issue
Block a user