User pages now start with their README.

This commit is contained in:
Flancian 2020-11-16 21:29:37 +01:00
parent 78ef6e5a2f
commit 2a7f81389e
2 changed files with 7 additions and 1 deletions

View file

@ -56,7 +56,7 @@ def today():
@bp.route('/user/<user>')
@bp.route('/@<user>')
def user(user):
return render_template('user.html', user=user, subnodes=db.subnodes_by_user(user))
return render_template('user.html', user=user, readmes=db.user_readmes(user), subnodes=db.subnodes_by_user(user))
@bp.route('/garden/<garden>')
def garden(garden):

View file

@ -181,6 +181,12 @@ def subnodes_by_user(user):
subnodes = [subnode for subnode in all_subnodes() if subnode.user == user]
return subnodes
def user_readmes(user):
# hack hack
# fix duplication.
subnodes = [subnode for subnode in all_subnodes() if subnode.user == user and re.search('readme', subnode.wikilink, re.IGNORECASE)]
return subnodes
def subnode_by_uri(uri):
subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri]
if subnode: