Using the user fullname when rendering a sketch.

Also refactored the portal page for sketches and moved the common code
to the lms_sketch doctype module.
This commit is contained in:
Anand Chitipothu
2021-03-11 11:53:06 +00:00
parent 4fe91422f4
commit 5f8de7612b
3 changed files with 36 additions and 13 deletions

View File

@@ -20,7 +20,7 @@
<div class="sketch-preview mb-5">
<span class="sketch-ts">{{ sketch.modified }}</span>
<a href="/sketches/sketch?sketch={{sketch.name}}">{{sketch.title}}</a>
By {{sketch.owner}}
By {{sketch.owner_name}}
</div>
{% endfor %}
</div>

View File

@@ -1,16 +1,7 @@
import frappe
from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches
def get_context(context):
context.no_cache = 1
context.sketches = get_sketches()
context.sketches = get_recent_sketches()
def get_sketches():
sketches = frappe.get_all(
"LMS Sketch",
fields=['name', 'title', 'owner', 'modified'],
order_by='modified desc',
page_length=100
)
for s in sketches:
s['owner'] = s['owner'].split("@")[0]
return sketches