Skip to content

Commit 1df7f13

Browse files
authored
Merge pull request #634 from nlsfnr/fix-ci
Fix use of is and is not vs. ==
2 parents 3a81c0e + 4bb6bf1 commit 1df7f13

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

polymorphic/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __new__(self, model_name, bases, attrs, **kwargs):
7373
# determine the name of the primary key field and store it into the class variable
7474
# polymorphic_primary_key_name (it is needed by query.py)
7575
for f in new_class._meta.fields:
76-
if f.primary_key and type(f) != models.OneToOneField:
76+
if f.primary_key and type(f) is not models.OneToOneField:
7777
new_class.polymorphic_primary_key_name = f.name
7878
break
7979

polymorphic/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def tree_node_test___lookup(my_model, node):
267267
for i in range(len(node.children)):
268268
child = node.children[i]
269269

270-
if type(child) == tuple:
270+
if type(child) is tuple:
271271
# this Q object child is a tuple => a kwarg like Q( instance_of=ModelB )
272272
assert "___" not in child[0], ___lookup_assert_msg
273273
else:

polymorphic/showfields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _showfields_add_regular_fields(self, parts):
6262
out = field.name
6363

6464
# if this is the standard primary key named "id", print it as we did with older versions of django_polymorphic
65-
if field.primary_key and field.name == "id" and type(field) == models.AutoField:
65+
if field.primary_key and field.name == "id" and type(field) is models.AutoField:
6666
out += f" {getattr(self, field.name)}"
6767

6868
# otherwise, display it just like all other fields (with correct type, shortened content etc.)

0 commit comments

Comments
 (0)