From 9eeb8bd8730d3ac943f04cf356f914acc57357e5 Mon Sep 17 00:00:00 2001 From: Kiril Kovachev Date: Fri, 18 Oct 2024 16:36:03 +0100 Subject: [PATCH] Add user page stub --- kanken_online/__init__.py | 11 +++++++++++ kanken_online/templates/user_page.html | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 kanken_online/templates/user_page.html diff --git a/kanken_online/__init__.py b/kanken_online/__init__.py index 480d9eb..9abd87a 100644 --- a/kanken_online/__init__.py +++ b/kanken_online/__init__.py @@ -67,6 +67,17 @@ def create_app(test_config=None): else: return update_settings(request.form) + @app.get("/user/") + def user_page(user_id: int): + db = get_database() + (username,) = db.execute("SELECT username FROM user WHERE id = ?", (user_id,)).fetchone() + return render_template("user_page.html", username=username) + + @app.get("/me") + @login_required + def my_page(): + return user_page(session["user_id"]) + def format_reading(reading: str) -> str: """Apply bold to the part of the reading which the kanji represents; for kun, this can be e.g. 選: えら-ぶ --> えらぶ. For reading strings which don't have any "-" character in them, diff --git a/kanken_online/templates/user_page.html b/kanken_online/templates/user_page.html new file mode 100644 index 0000000..edc2e35 --- /dev/null +++ b/kanken_online/templates/user_page.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} + +{% block header %} +

{% block title %}{{ localize("user_introduction") }} {{ username }}{% endblock %}

+{% endblock %} + +{% block content %} + (profile picture) +{% endblock %} \ No newline at end of file