Ticket #16458: models_equality-16458.diff

File models_equality-16458.diff, 619 bytes (added by teraom, 13 years ago)
  • django/db/models/base.py

     
    382382        return '%s object' % self.__class__.__name__
    383383
    384384    def __eq__(self, other):
    385         return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val()
     385        return (isinstance(other, self.__class__) or isinstance(self, other.__class__)) and \
     386                (self._get_pk_val() == other._get_pk_val())
    386387
    387388    def __ne__(self, other):
    388389        return not self.__eq__(other)
Back to Top