Skip to content

Commit

Permalink
prefill of sponsor details in the donation form: passed
Browse files Browse the repository at this point in the history
  • Loading branch information
dcruz authored and ecino committed Apr 8, 2024
1 parent 461ae78 commit 2b5fac9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions my_compassion/controllers/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,22 @@ def my_child(self, state="active", child_id=None, **kwargs):
wordpress = (
request.env["wordpress.configuration"].sudo().get_config(raise_error=False)
)
partner_profile_info = {
"child_ref": child.local_id,
"pname": partner.firstname + " " + partner.lastname,
"cname": partner.company_id.name,
"pstreet": partner.street,
"pzip": partner.zip,
"pcity": partner.city,
"pcountry": partner.country_id.name,
"email": partner.email,
# Add any other fields you want to prefill in the form
}
# Construct query string with user profile info
query_string = urlencode(partner_profile_info)
url_child_gift = (
(f"https://{wordpress.host}{wordpress.child_gift_url}")
if wordpress
(f"https://{wordpress.host}{wordpress.child_gift_url}?{query_string}")
if wordpress and partner_profile_info
else "#"
)

Expand Down

0 comments on commit 2b5fac9

Please sign in to comment.