From a1cc107b3c65ff110124576d3609043f593a67f4 Mon Sep 17 00:00:00 2001 From: raven Date: Fri, 18 Jun 2021 21:13:56 +0000 Subject: actually add the files --- apioforum/templates/view_user.html | 22 ++++++++++++++++++++++ apioforum/user.py | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 apioforum/templates/view_user.html create mode 100644 apioforum/user.py diff --git a/apioforum/templates/view_user.html b/apioforum/templates/view_user.html new file mode 100644 index 0000000..c9d9c1c --- /dev/null +++ b/apioforum/templates/view_user.html @@ -0,0 +1,22 @@ +{% from 'common.html' import disp_post,ts %} +{% extends 'base.html' %} +{% block header %} +

{%block title %}{{user.username|e}}{% endblock %}

+{% endblock %} + +{%block content%} +
+
+
{{rendered_bio|safe}}
+

— {{user.username|e}}

+
+
+
joined
+ {% if user.joined %} +
{{ts(user.joined)}}
+ {% else %} +
a very long time ago
+ {% endif %} +
+
+{% endblock %} diff --git a/apioforum/user.py b/apioforum/user.py new file mode 100644 index 0000000..cdf38d3 --- /dev/null +++ b/apioforum/user.py @@ -0,0 +1,19 @@ +# user pages + +from flask import ( + Blueprint, render_template, abort, g +) + +from .db import get_db +from .mdrender import render + +bp = Blueprint("user", __name__, url_prefix="/user") + +@bp.route("/") +def view_user(username): + db = get_db() + user = db.execute("SELECT * FROM users WHERE username = ?;",(username,)).fetchone() + if user is None: + abort(404) + return render_template("view_user.html", + user=user, rendered_bio=render(user['bio'] or "hail GEORGE")) -- cgit v1.2.3