Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,14 +1799,11 @@ def __hash__(self):

def __eq__(self, other):
if isinstance(other, Endpoint):
# Check if the contents of the endpoint match
contents_match = str(self) == str(other)
# Determine if products should be used in the equation
if self.product is not None and other.product is not None:
# Check if the products are the same
products_match = (self.product) == other.product
# Check if the contents match
return products_match and contents_match
# Use product_id (cached integer) instead of self.product to avoid
# triggering a FK lookup on every comparison inside NestedObjects.add_edge.
if self.product_id is not None and other.product_id is not None:
return self.product_id == other.product_id and contents_match
return contents_match

return NotImplemented
Expand Down
Loading