From 5edceb25627309609f33a75bab41fbac5131cd03 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Fri, 7 May 2021 17:14:33 +0530 Subject: [PATCH] fix: photo from user --- .../community/doctype/community_member/community_member.py | 3 +++ community/community/widgets/Avatar.html | 4 ++-- community/www/courses/about/index.html | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/community/community/doctype/community_member/community_member.py b/community/community/doctype/community_member/community_member.py index 0a36a91b..0c1ecdb3 100644 --- a/community/community/doctype/community_member/community_member.py +++ b/community/community/doctype/community_member/community_member.py @@ -47,6 +47,9 @@ class CommunityMember(Document): 'member_type': 'Mentor' }) + def get_photo_url(self): + return frappe.db.get_value("User", self.email, ["user_image"]) + def get_palette(self): palette = [ ['--orange-avatar-bg', '--orange-avatar-color'], diff --git a/community/community/widgets/Avatar.html b/community/community/widgets/Avatar.html index e0c88cf5..fac236df 100644 --- a/community/community/widgets/Avatar.html +++ b/community/community/widgets/Avatar.html @@ -1,8 +1,8 @@ {% set color = member.get_palette() %} - {% if member.photo %} - + {% if member.get_photo_url() %} + {% else %} - {% if m.photo_url %} - - {% endif %} + {{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} {{m.full_name}} {% endfor %}