Skip to content

Commit

Permalink
Rename get_share_url_object to get_object_share_url
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Feb 22, 2024
1 parent 79dcc49 commit 5610404
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lemarche/siaes/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions lemarche/utils/export.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lemarche/utils/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"


Expand Down
14 changes: 7 additions & 7 deletions lemarche/www/tenders/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 5610404

Please sign in to comment.