feat: profile page
This commit is contained in:
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user