Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Unify url field names in context for easier handling

Jakub Draganeked156f33f14f
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index 94efe7230a..a78db590be 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -7,17 +7,17 @@ CONFIRM_ORDER_TEMPLATE = 'order/confirm_order'
CONFIRM_PAYMENT_TEMPLATE = 'order/payment/confirm_payment'
-def __send_confirmation(address, url, url_name, template):
+def __send_confirmation(address, url, template):
send_templated_mail(from_email=settings.ORDER_FROM_EMAIL,
recipient_list=[address],
context={'site_name': get_site_name(),
- url_name: url},
+ 'url': url},
template_name=template)
def send_order_confirmation(address, url):
- __send_confirmation(address, url, 'order_url', CONFIRM_ORDER_TEMPLATE)
+ __send_confirmation(address, url, CONFIRM_ORDER_TEMPLATE)
def send_payment_confirmation(address, url):
- __send_confirmation(address, url, 'payment_url', CONFIRM_PAYMENT_TEMPLATE)
+ __send_confirmation(address, url, CONFIRM_PAYMENT_TEMPLATE)
diff --git a/saleor/order/models.py b/saleor/order/models.py
index b283bd64c7..d772361866 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -16,14 +16,12 @@ from payments import PaymentStatus, PurchasedItem
from payments.models import BasePayment
from prices import Price, FixedDiscount
from satchless.item import ItemLine, ItemSet
-from templated_email import send_templated_mail
from ..core.utils import build_absolute_uri
from ..discount.models import Voucher
from ..product.models import Product
from ..userprofile.models import Address
from ..search import index
-from ..site.utils import get_site_name
from . import OrderStatus
from . import emails
diff --git a/templates/templated_email/order/confirm_order.email b/templates/templated_email/order/confirm_order.email
index 7bdede0e73..2b174f6387 100644
--- a/templates/templated_email/order/confirm_order.email
+++ b/templates/templated_email/order/confirm_order.email
@@ -9,7 +9,7 @@
Hi!
Thank you for your order. To see your payment details please visit:
-{{ payment_url }}
+{{ url }}
Sincerely,
{{ site_name }}
diff --git a/templates/templated_email/order/payment/confirm_payment.email b/templates/templated_email/order/payment/confirm_payment.email
index 94a60037af..f890526d6c 100644
--- a/templates/templated_email/order/payment/confirm_payment.email
+++ b/templates/templated_email/order/payment/confirm_payment.email
@@ -9,7 +9,7 @@
Hi!
Thank you for your payment. To see your payment details please visit:
-{{ order_url }}
+{{ url }}
Sincerely,
{{ site_name }}
diff --git a/tests/test_emails.py b/tests/test_emails.py
index 69df7152a7..9ad43d9879 100644
--- a/tests/test_emails.py
+++ b/tests/test_emails.py
@@ -17,7 +17,7 @@ EMAIL_FROM = settings.ORDER_FROM_EMAIL
def test_send_confirmation_using_templated_email(mocked_templated_email,
mocked_get_site_name):
emails.send_order_confirmation(EMAIL, URL)
- context = {'site_name': SITE_NAME, 'order_url': URL}
+ context = {'site_name': SITE_NAME, 'url': URL}
mocked_templated_email.assert_called_once_with(
recipient_list=[EMAIL], context=context, from_email=EMAIL_FROM,
template_name=emails.CONFIRM_ORDER_TEMPLATE)
@@ -28,7 +28,7 @@ def test_send_confirmation_using_templated_email(mocked_templated_email,
def test_send_order_payment_confirmation(mocked_templated_email,
mocked_get_site_name):
emails.send_payment_confirmation(EMAIL, URL)
- context = {'site_name': SITE_NAME, 'payment_url': URL}
+ context = {'site_name': SITE_NAME, 'url': URL}
mocked_templated_email.assert_called_once_with(
recipient_list=[EMAIL], context=context, from_email=EMAIL_FROM,
template_name=emails.CONFIRM_PAYMENT_TEMPLATE)