diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-07 09:51:32 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-19 09:51:28 +0300 |
| commit | 4668c142dce77c6f29fb75532c1acfa1b2d322ff (patch) | |
| tree | 0d4bfb51d43879c9e0410e42152542a3c78e828d /django | |
| parent | 40909826172374b849ddc9db8e1a8be9a8c3251b (diff) | |
Made Model.__eq__ consider proxy models equivalent
Fixed #11892, fixed #16458, fixed #14492.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index cd3768bccb..3e2ae8d425 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -459,7 +459,9 @@ class Model(six.with_metaclass(ModelBase)): return '%s object' % self.__class__.__name__ def __eq__(self, other): - return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val() + return (isinstance(other, Model) and + self._meta.concrete_model == other._meta.concrete_model and + self._get_pk_val() == other._get_pk_val()) def __ne__(self, other): return not self.__eq__(other) |
