I'm using the Python libraries for Google App Engine. How can I override the equals()
method on a class so that it judges equality on the user_id
field of the following class:
class UserAccount(db.Model):
# compare all equality tests on user_id
user = db.UserProperty(required=True)
user_id = db.StringProperty(required=True)
first_name = db.StringProperty()
last_name = db.StringProperty()
notifications = db.ListProperty(db.Key)
Right now, I'm doing equalty by getting a UserAccount
object and doing user1.user_id == user2.user_id
. Is there a way I can override it so that 'user1 == user2' will look at only the 'user_id' fields?
Thanks in advance