handle name can be None in get_name_initial()

This commit is contained in:
Son NK 2021-01-15 11:21:45 +01:00
parent f4218a0693
commit 4bfe6d1ac9
1 changed files with 2 additions and 0 deletions

View File

@ -524,6 +524,8 @@ class User(db.Model, ModelMixin, UserMixin):
return self.name, [other_name, "Anonymous", "whoami"]
def get_name_initial(self) -> str:
if not self.name:
return ""
names = self.name.split(" ")
return "".join([n[0].upper() for n in names if n])