feat(postcards): add notes field to postcards with edit, detail, and truncated list display

This commit is contained in:
2026-07-06 21:07:28 +08:00
parent f6db3a4f55
commit 68c88a7910
6 changed files with 16 additions and 0 deletions

View File

@@ -529,6 +529,7 @@ def postcard_create(
arrival_time: str = Form(""),
sender_name: str = Form(""),
receive_time: str = Form(""),
notes: str = Form(""),
user: User = Depends(get_current_user_web),
db: Session = Depends(get_db),
):
@@ -558,6 +559,7 @@ def postcard_create(
arrival_time=_parse_dt(arrival_time),
sender_name=sender_name or None,
receive_time=_parse_dt(receive_time),
notes=notes.strip(),
)
db.add(pc)
db.commit()
@@ -602,6 +604,7 @@ def postcard_update(
arrival_time: str = Form(""),
sender_name: str = Form(""),
receive_time: str = Form(""),
notes: str = Form(""),
user: User = Depends(get_current_user_web),
db: Session = Depends(get_db),
):
@@ -634,6 +637,7 @@ def postcard_update(
pc.arrival_time = None if status == "sent" else _parse_dt(arrival_time)
pc.sender_name = sender_name or None
pc.receive_time = _parse_dt(receive_time)
pc.notes = notes.strip()
db.commit()
return _redirect(f"/postcards/{postcard_id}")