fix(web): correct country_to form parameter name mismatch in create and edit routes

This commit is contained in:
2026-07-10 23:07:56 +08:00
parent 3323523e8e
commit d79aaea4ae

View File

@@ -736,7 +736,7 @@ def postcard_create(
card_number: str = Form(...), card_number: str = Form(...),
status: str = Form(...), status: str = Form(...),
recipient_name: str = Form(""), recipient_name: str = Form(""),
country: str = Form(""), country_to: str = Form(""),
country_from: str = Form(""), country_from: str = Form(""),
send_time: str = Form(""), send_time: str = Form(""),
arrival_time: str = Form(""), arrival_time: str = Form(""),
@@ -778,7 +778,7 @@ def postcard_create(
status=status, status=status,
recipient_name=recipient_name or None, recipient_name=recipient_name or None,
country_from=(country_from.strip().upper() if country_from else profile.country), country_from=(country_from.strip().upper() if country_from else profile.country),
country_to=(country.strip().upper() if country else None), country_to=(country_to.strip().upper() if country_to else None),
send_time=_parse_dt(send_time), send_time=_parse_dt(send_time),
arrival_time=_parse_dt(arrival_time), arrival_time=_parse_dt(arrival_time),
sender_name=sender_name or None, sender_name=sender_name or None,
@@ -823,7 +823,7 @@ def postcard_update(
card_number: str = Form(...), card_number: str = Form(...),
status: str = Form(...), status: str = Form(...),
recipient_name: str = Form(""), recipient_name: str = Form(""),
country: str = Form(""), country_to: str = Form(""),
country_from: str = Form(""), country_from: str = Form(""),
send_time: str = Form(""), send_time: str = Form(""),
arrival_time: str = Form(""), arrival_time: str = Form(""),
@@ -869,7 +869,7 @@ def postcard_update(
pc.status = status pc.status = status
pc.recipient_name = recipient_name or None pc.recipient_name = recipient_name or None
pc.country_from = country_from.strip().upper() if country_from else pc.country_from pc.country_from = country_from.strip().upper() if country_from else pc.country_from
pc.country_to = country or None pc.country_to = country_to or None
pc.send_time = _parse_dt(send_time) pc.send_time = _parse_dt(send_time)
pc.arrival_time = None if status == "sent" else _parse_dt(arrival_time) pc.arrival_time = None if status == "sent" else _parse_dt(arrival_time)
pc.sender_name = sender_name or None pc.sender_name = sender_name or None