__eq__ should only compare same types

unless it's a string
This commit is contained in:
Swen Kooij 2017-03-09 11:58:49 +02:00
parent b3d7092b91
commit 3d08475468

View File

@ -85,6 +85,11 @@ class LocalizedValue:
And False when they are not.
"""
if not isinstance(other, type(self)):
if isinstance(other, str):
return self.__str__() == other
return False
for lang_code, _ in settings.LANGUAGES:
if self.get(lang_code) != other.get(lang_code):
return False