Skip to content

Commit df51d54

Browse files
committed
Replace type(..) is checks with isinstance
1 parent ec31670 commit df51d54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polymorphic/query_translate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def translate_polymorphic_filter_definitions_in_kwargs(
4646
queryset_model, field_path, val, using=using
4747
)
4848

49-
if type(new_expr) == tuple:
49+
if isinstance(new_expr, tuple):
5050
# replace kwargs element
5151
del kwargs[field_path]
5252
kwargs[new_expr[0]] = new_expr[1]
@@ -66,7 +66,7 @@ def tree_node_correct_field_specs(my_model, node):
6666
for i in range(len(node.children)):
6767
child = node.children[i]
6868

69-
if type(child) == tuple or type(child) == list:
69+
if isinstance(child, (tuple, list)):
7070
# this Q object child is a tuple => a kwarg like Q( instance_of=ModelB )
7171
key, val = child
7272
new_expr = _translate_polymorphic_filter_definition(

0 commit comments

Comments
 (0)