diff --git a/django/db/models/base.py b/django/db/models/base.py
index 6077f56..e9db687 100644
a
|
b
|
class Model(object):
|
370 | 370 | return '%s object' % self.__class__.__name__ |
371 | 371 | |
372 | 372 | def __eq__(self, other): |
373 | | return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val() |
| 373 | if isinstance(other, self.__class__): |
| 374 | return self.pk == other.pk |
| 375 | return NotImplemented |
374 | 376 | |
375 | 377 | def __ne__(self, other): |
376 | | return not self.__eq__(other) |
| 378 | return not self == other |
377 | 379 | |
378 | 380 | def __hash__(self): |
379 | 381 | return hash(self._get_pk_val()) |
diff --git a/tests/modeltests/proxy_models/tests.py b/tests/modeltests/proxy_models/tests.py
index 346a2a3..32bdc83 100644
a
|
b
|
class ProxyModelTests(TestCase):
|
312 | 312 | management.call_command('loaddata', 'mypeople.json', verbosity=0, commit=False) |
313 | 313 | p = MyPerson.objects.get(pk=100) |
314 | 314 | self.assertEqual(p.name, 'Elvis Presley') |
| 315 | |
| 316 | def test_eq(self): |
| 317 | s = State(pk=3) |
| 318 | sp = StateProxy(pk=3) |
| 319 | self.assertEqual(s, sp) |
| 320 | self.assertEqual(sp, s) |
| 321 | sp = StateProxy(pk=4) |
| 322 | self.assertNotEqual(s, sp) |
| 323 | self.assertNotEqual(sp, s) |