Django comparing model instances for equality
- by orokusaki
I understand that, with a singleton situation, you can perform such an operation as:
spam == eggs
and if spam and eggs are instances of the same class with all the same attribute values, it will return True. In a Django model, this is natural because two separate instances of a model won't ever be the same unless they have the same .pk value.
…