From 92501d8e41274d6ba4e803660c91ec6f634befaa Mon Sep 17 00:00:00 2001
From: Bastian Kleineidam <calvin@debian.org>
Date: Mon, 28 Jan 2008 13:58:32 +0100
Subject: Make models hashable

The Model instances should be hashable so that tests like
"instance in set([instance1, instance2])" actually succeed.

Signed-off-by: Bastian Kleineidam <calvin@debian.org>

diff --git a/django/db/models/base.py b/django/db/models/base.py
index 57660dd..c52d3dd 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -110,6 +110,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)
 
-- 
1.5.3.8

