default to avatar placeholder if avatar has a value but no name

This commit is contained in:
Michael Hall 2018-03-18 12:30:26 -04:00
parent 97de26ea85
commit 9befdc9377

View file

@ -46,7 +46,7 @@ class UserProfile(models.Model):
return "Unknown Profile"
def avatar_url(self):
if self.avatar is None or self.avatar == '':
if self.avatar is None or self.avatar.name is None:
return settings.STATIC_URL + 'img/avatar_placeholder.png'
elif self.avatar.name.startswith('http'):
return self.avatar.name