Esempio n. 1
0
    def get_author(self):
        from django.conf import settings
        from booktype.apps.account import utils

        if self.user:
            return {
                'name': self.user.get_full_name() or self.user.username,
                'avatar': utils.get_profile_image(self.user, 35)
            }
        else:
            return {
                'name': self.author,
                'avatar': '{}{}'.format(settings.STATIC_URL, 'account/images/anonymous.png')
            }
Esempio n. 2
0
 def render(self, context):
     user = resolve_variable(self.user, context)
     image_url = utils.get_profile_image(user)
     return mark_safe('<img src="{url}?{anti_cache}"/>'.format(url=image_url, anti_cache=str(uuid.uuid4())))
Esempio n. 3
0
 def get_profile_image_url(self, obj):
     return account_utils.get_profile_image(obj)