diff --git a/ulakbus/models/auth.py b/ulakbus/models/auth.py index d8dbb4e0..4707135b 100644 --- a/ulakbus/models/auth.py +++ b/ulakbus/models/auth.py @@ -9,6 +9,7 @@ # # This file is licensed under the GNU General Public License v3 # (GPLv3). See LICENSE.txt for details. +import hashlib from pyoko import field from pyoko import Model, ListNode @@ -62,6 +63,14 @@ def pre_save(self): def post_creation(self): self.prepare_channels() + def get_avatar_url(self): + if self.avatar: + return super(BaseUser, self).get_avatar_url() + else: + # FIXME: This is for fun, remove when we resolve static hosting problem + return "https://www.gravatar.com/avatar/%s" % hashlib.md5( + "%s@gmail.com" % self.username).hexdigest() + # def send_message(self, title, message, sender=None):