mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-25 11:42:54 +03:00
__eq__ should only compare same types
unless it's a string
This commit is contained in:
parent
b3d7092b91
commit
3d08475468
@ -85,6 +85,11 @@ class LocalizedValue:
|
|||||||
And False when they are not.
|
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:
|
for lang_code, _ in settings.LANGUAGES:
|
||||||
if self.get(lang_code) != other.get(lang_code):
|
if self.get(lang_code) != other.get(lang_code):
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user