diff --git a/django/db/models/base.py b/django/db/models/base.py
index 71fd1f7..fba040f 100644
a
|
b
|
class ModelBase(type):
|
39 | 39 | # Create the class. |
40 | 40 | module = attrs.pop('__module__') |
41 | 41 | new_class = super_new(cls, name, bases, {'__module__': module}) |
| 42 | new_class._real_class = new_class |
42 | 43 | attr_meta = attrs.pop('Meta', None) |
43 | 44 | abstract = getattr(attr_meta, 'abstract', False) |
44 | 45 | if not attr_meta: |
… |
… |
class Model(object):
|
382 | 383 | return '%s object' % self.__class__.__name__ |
383 | 384 | |
384 | 385 | def __eq__(self, other): |
385 | | return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val() |
| 386 | return self._real_class == other._real_class and self._get_pk_val() == other._get_pk_val() |
386 | 387 | |
387 | 388 | def __ne__(self, other): |
388 | 389 | return not self.__eq__(other) |
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index a56ab5c..b4e63e3 100644
a
|
b
|
def deferred_class_factory(model, attrs):
|
162 | 162 | overrides["Meta"] = Meta |
163 | 163 | overrides["__module__"] = model.__module__ |
164 | 164 | overrides["_deferred"] = True |
| 165 | overrides["_real_class"] = model |
165 | 166 | return type(name, (model,), overrides) |
166 | 167 | |
167 | 168 | # The above function is also used to unpickle model instances with deferred |