forked from CGM_Public/pretix_original
Implemented LazyI18nString.__bool__ to return False on empty strings
This commit is contained in:
@@ -40,6 +40,9 @@ class LazyI18nString:
|
|||||||
"""
|
"""
|
||||||
return self.localize(translation.get_language())
|
return self.localize(translation.get_language())
|
||||||
|
|
||||||
|
def __bool__(self):
|
||||||
|
return bool(len(self.data)) and any(self.data.values())
|
||||||
|
|
||||||
def localize(self, lng):
|
def localize(self, lng):
|
||||||
if self.data is None:
|
if self.data is None:
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user