def __eq__(self, other):
        if (isinstance(other, PhoneNumber) or
                isinstance(other, phonenumbers.PhoneNumber) or
                isinstance(other, string_types)):
            format_string = getattr(settings, 'PHONENUMBER_DB_FORMAT', 'E164')
            default_region = getattr(settings, 'PHONENUMBER_DEFAULT_REGION',
                                     None)
            fmt = self.format_map[format_string]
            if isinstance(other, string_types):
                # convert string to phonenumbers.PhoneNumber
                # instance
                try:
                    other = phonenumbers.parse(
                        other, region=default_region)
                except NumberParseException:
                    # Conversion is not possible, thus not equal
                    return False
            other_string = phonenumbers.format_number(other, fmt)
            return self.format_as(fmt) == other_string
        else:
            return False
Override parent equality because we store only string representation
dataset/ETHPy150Open stefanfoulis/django-phonenumber-field/phonenumber_field/phonenumber.py/PhoneNumber.__eq__