Skip to content

Commit

Permalink
refactor: add __eq__ on Table
Browse files Browse the repository at this point in the history
  • Loading branch information
aarcex3 committed Oct 14, 2024
1 parent f4bf25a commit 14c3cc9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions piccolo/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,13 @@ def __repr__(self) -> str:
)
return f"<{self.__class__.__name__}: {pk}>"

def __eq__(self, other: Table):
return (
isinstance(other, self.__class__)
and self.__class__._meta.primary_key
== other.__class__._meta.primary_key
)

###########################################################################
# Classmethods

Expand Down

0 comments on commit 14c3cc9

Please sign in to comment.