feat: profile page

This commit is contained in:
pateljannat
2021-04-14 11:19:02 +05:30
parent 88888903ab
commit e8ff9a5a32
9 changed files with 156 additions and 27 deletions

View File

@@ -1,18 +1,9 @@
import frappe
from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches
def get_context(context):
context.no_cache = 1
username = frappe.form_dict.get('username')
user = username and get_user(username)
if not user:
context.template = "www/404.html"
user.abbr = "".join([s[0] for s in user.full_name.split()])
context.user = user
def get_user(username):
try:
return frappe.get_doc("Community Member", username)
except frappe.DoesNotExistError:
return
context.username = frappe.form_dict['username']
context.member = frappe.get_doc("Community Member", {"username":context.username})
context.abbr = "".join([s[0] for s in context.member.full_name.split()])
context.sketches = list(filter(lambda x: x.owner == context.member.email, get_recent_sketches()))