From 9db6b849d41d7b7ccee8b3aa50ce85c02354583f Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Mon, 6 Jul 2026 19:39:54 +0800 Subject: [PATCH] feat(profiles): notes shown on postcards page, save stays on current page --- app/routers/web.py | 4 ++-- app/templates/postcards.html | 7 +++++++ app/templates/profiles.html | 10 ++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/routers/web.py b/app/routers/web.py index d9dae80..8c571c4 100644 --- a/app/routers/web.py +++ b/app/routers/web.py @@ -452,12 +452,12 @@ def profile_rename(profile_id: int, nickname: str = Form(...), user: User = Depe @router.post("/profiles/{profile_id}/notes") -def profile_notes(profile_id: int, notes: str = Form(""), user: User = Depends(get_current_user_web), db: Session = Depends(get_db)): +def profile_notes(profile_id: int, notes: str = Form(""), redirect_to: str = Form("/profiles"), user: User = Depends(get_current_user_web), db: Session = Depends(get_db)): p = db.query(Profile).filter(Profile.id == profile_id, Profile.user_id == user.id).first() if p: p.notes = notes db.commit() - return _redirect("/profiles") + return _redirect(redirect_to) # ---------- Postcards ---------- diff --git a/app/templates/postcards.html b/app/templates/postcards.html index 63b6b15..af287f5 100644 --- a/app/templates/postcards.html +++ b/app/templates/postcards.html @@ -5,6 +5,13 @@

{{ profile.nickname }} 的明信片

+ 新明信片 +
+
+ + + +
+
-
- -
+
+ + +