diff --git a/lemarche/siaes/tasks.py b/lemarche/siaes/tasks.py index 2c36d76fd..df25ca4a3 100644 --- a/lemarche/siaes/tasks.py +++ b/lemarche/siaes/tasks.py @@ -7,7 +7,7 @@ from lemarche.utils.apis import api_mailjet from lemarche.utils.apis.geocoding import get_geocoding_data from lemarche.utils.emails import whitelist_recipient_list -from lemarche.utils.urls import get_domain_url, get_share_url_object +from lemarche.utils.urls import get_domain_url, get_object_share_url @task() @@ -46,7 +46,7 @@ def send_completion_reminder_email_to_siae(siae): variables = { "SIAE_USER_FIRST_NAME": siae_user.first_name, "SIAE_NAME": siae.name_display, - "SIAE_URL": get_share_url_object(siae), + "SIAE_URL": get_object_share_url(siae), "SIAE_EDIT_URL": f"https://{get_domain_url()}{reverse_lazy('dashboard_siaes:siae_edit_contact', args=[siae.slug])}", # noqa } diff --git a/lemarche/utils/export.py b/lemarche/utils/export.py index 8efbdd698..48304b824 100644 --- a/lemarche/utils/export.py +++ b/lemarche/utils/export.py @@ -1,7 +1,7 @@ import xlwt from lemarche.siaes.models import Siae -from lemarche.utils.urls import get_share_url_object +from lemarche.utils.urls import get_object_share_url SIAE_FIELDS_TO_EXPORT = [ @@ -73,7 +73,7 @@ def generate_siae_row(siae: Siae, siae_field_list): elif field_name == "Inscrite": col_value = "Oui" if siae.user_count else "Non" elif field_name == "Lien vers le marché": - col_value = f"{get_share_url_object(siae)}?cmp=export-excel" + col_value = f"{get_object_share_url(siae)}?cmp=export-excel" else: col_value = getattr(siae, field_name, "") siae_row.append(col_value) diff --git a/lemarche/utils/urls.py b/lemarche/utils/urls.py index 776c99129..e7bf0340c 100644 --- a/lemarche/utils/urls.py +++ b/lemarche/utils/urls.py @@ -53,7 +53,7 @@ def get_safe_url(request, param_name=None, fallback_url=None, url=None): return fallback_url -def get_share_url_object(obj: Model): +def get_object_share_url(obj: Model): return f"https://{get_domain_url()}{obj.get_absolute_url()}" diff --git a/lemarche/www/tenders/tasks.py b/lemarche/www/tenders/tasks.py index 06d274924..94300de2b 100644 --- a/lemarche/www/tenders/tasks.py +++ b/lemarche/www/tenders/tasks.py @@ -12,7 +12,7 @@ from lemarche.utils.apis import api_hubspot, api_mailjet, api_slack from lemarche.utils.data import date_to_string from lemarche.utils.emails import send_mail_async, whitelist_recipient_list -from lemarche.utils.urls import get_domain_url, get_object_admin_url, get_share_url_object +from lemarche.utils.urls import get_domain_url, get_object_admin_url, get_object_share_url logger = logging.getLogger(__name__) @@ -140,7 +140,7 @@ def send_tender_email_to_partner(email_subject: str, tender: Tender, partner: Pa "TENDER_SECTORS": tender.sectors_list_string(), "TENDER_PERIMETERS": tender.location_display, "TENDER_DEADLINE_DATE": date_to_string(tender.deadline_date), - "TENDER_URL": get_share_url_object(tender), + "TENDER_URL": get_object_share_url(tender), } api_mailjet.send_transactional_email_many_recipient_with_template( @@ -189,7 +189,7 @@ def send_tender_email_to_siae(tender: Tender, siae: Siae, email_subject: str, em "TENDER_PERIMETERS": tender.location_display, "TENDER_AMOUNT": tender.amount_display, "TENDER_DEADLINE_DATE": date_to_string(tender.deadline_date), - "TENDER_URL": f"{get_share_url_object(tender)}?siae_id={siae.id}", + "TENDER_URL": f"{get_object_share_url(tender)}?siae_id={siae.id}", } api_mailjet.send_transactional_email_with_template( @@ -267,7 +267,7 @@ def send_tender_contacted_reminder_email_to_siae( "TENDER_PERIMETERS": tendersiae.tender.location_display, "TENDER_AMOUNT": tendersiae.tender.amount_display, "TENDER_DEADLINE_DATE": date_to_string(tendersiae.tender.deadline_date), - "TENDER_URL": f"{get_share_url_object(tendersiae.tender)}?siae_id={tendersiae.siae.id}&mtm_campaign=relance-esi-contactees", # noqa + "TENDER_URL": f"{get_object_share_url(tendersiae.tender)}?siae_id={tendersiae.siae.id}&mtm_campaign=relance-esi-contactees", # noqa } api_mailjet.send_transactional_email_with_template( @@ -341,7 +341,7 @@ def send_tender_interested_reminder_email_to_siae( "TENDER_PERIMETERS": tendersiae.tender.location_display, "TENDER_AMOUNT": tendersiae.tender.amount_display, "TENDER_DEADLINE_DATE": date_to_string(tendersiae.tender.deadline_date), - "TENDER_URL": f"{get_share_url_object(tendersiae.tender)}?siae_id={tendersiae.siae.id}&mtm_campaign=relance-esi-interessees", # noqa + "TENDER_URL": f"{get_object_share_url(tendersiae.tender)}?siae_id={tendersiae.siae.id}&mtm_campaign=relance-esi-interessees", # noqa } api_mailjet.send_transactional_email_with_template( @@ -386,7 +386,7 @@ def send_confirmation_published_email_to_author(tender: Tender, nb_matched_siaes "TENDER_AMOUNT": tender.amount_display, "TENDER_DEADLINE_DATE": date_to_string(tender.deadline_date), "TENDER_NB_MATCH": nb_matched_siaes, - "TENDER_URL": get_share_url_object(tender), + "TENDER_URL": get_object_share_url(tender), } api_mailjet.send_transactional_email_with_template( @@ -456,7 +456,7 @@ def send_siae_interested_email_to_author(tender: Tender): variables = { "TENDER_AUTHOR_FIRST_NAME": tender.author.first_name, "TENDER_TITLE": tender.title, - "TENDER_SIAE_INTERESTED_LIST_URL": f"{get_share_url_object(tender)}/prestataires", # noqa + "TENDER_SIAE_INTERESTED_LIST_URL": f"{get_object_share_url(tender)}/prestataires", # noqa } api_mailjet.send_transactional_email_with_template(