python - How to override equals() in google app engine data model type? -


I am using Python libraries for Google App Engine. How much is it that this decision of equality on equals in a square () can override the method user_id area of ​​the following classes:

  class user account (db.Model): # user_id user = db.UserProperty (expected = true) user_id = db.StringProperty (expected = true) first_name = db.StringProperty () last_name = db.StringProperty () Notification But compare all equality tests on = db.ListProperty (db.Key)  

Right now, I am getting a user account object and tax user1.user_id by I'm equalty == user2.user_id . Is there any way I can override it so that 'user1 == user2' will only see the 'user_id' field?

Thank you in advance

defy operators __ eq __ (==) and __ ne __ (! =)

for example

  class user account (db.Model): def __eq __ (self, others): if isinstance (other, user account): return self.user_id == other.user_id return NotImplemented def __ne __ (self, other): results = self .__ eq __ (other) if not the result Unable to: Result result result not return  

Comments