summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-19 01:59:34 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-19 01:59:34 +0000
commit343fa35a2cd4bb22457eb9031fa23c751c13f09d (patch)
tree78051b1b8dc66484ecacfeeaa797ad1bca645384 /django/db
parentf1a24be01cbd7d268d90c3fdf65a08fe1407f440 (diff)
Fixed #2936, #6500 -- Added a __hash__() method to Models (since we implement our own __eq__ method).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
-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)