diasporadiaries

a platform for writing stories with personal accounts and messages
git clone git://parazyd.org/diasporadiaries.git
Log | Files | Refs | Submodules | README | LICENSE

commit 58fbdcc0e54e9a844a1b9353df5acde611f14157
parent c76e154820ba17bedeaa6a443e54b40d6b5e5ab4
Author: parazyd <parazyd@dyne.org>
Date:   Sun, 27 Jan 2019 21:03:33 +0100

Add user link to /view if existing.

Diffstat:
Mdiaspora.py | 5++++-
Mtemplates/view.html | 4++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/diaspora.py b/diaspora.py @@ -314,7 +314,10 @@ def view(): if not story_id: story_id = choice(sql_select_col('id'))[0] - return render_template('view.html', story=get_story(story_id)) + story = get_story(story_id) + user = find_user_by_email(story['email']) + + return render_template('view.html', story=story, user=user) @app.route('/delete') diff --git a/templates/view.html b/templates/view.html @@ -12,7 +12,11 @@ <hr> <p> + {% if user %} + by <a href="/profile?id={{ user['id'] }}">{{story['name'] }}</a>, {{ parsetime(story['time']) }} + {% else %} by {{ story['name'] }}, {{ parsetime(story['time']) }} + {% endif %} {% if story['city'] %} <br>in {{ story['city'] }} {% endif %}