summaryrefslogtreecommitdiff
path: root/django/db/models
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models')
-rw-r--r--django/db/models/base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 5aa3158fee..4f034bcf8b 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -135,6 +135,9 @@ class Model(object):
def __ne__(self, other):
return not self.__eq__(other)
+ def __hash__(self):
+ return hash(self._get_pk_val())
+
def __init__(self, *args, **kwargs):
dispatcher.send(signal=signals.pre_init, sender=self.__class__, args=args, kwargs=kwargs)