瀏覽代碼

[#3826] Streamline handling of links in email templates

master
Martin Winkel 3 年之前
父節點
當前提交
6eceb19a59

+ 3
- 0
src/oscar/apps/checkout/mixins.py 查看文件

@@ -290,6 +290,9 @@ class OrderPlacementMixin(CheckoutSessionMixin):
290 290
             # We don't care that much if we can't resolve the URL
291 291
             pass
292 292
         else:
293
+            ctx['status_path'] = path
294
+
295
+            # status_url is deprecated, see https://github.com/django-oscar/django-oscar/issues/3826
293 296
             site = Site.objects.get_current(self.request)
294 297
             ctx['status_url'] = 'http://%s%s' % (site.domain, path)
295 298
         return ctx

+ 3
- 2
src/oscar/templates/oscar/communication/emails/commtype_order_placed_body.html 查看文件

@@ -1,5 +1,5 @@
1 1
 {% extends "oscar/communication/emails/base.html" %}
2
-{% load currency_filters i18n %}
2
+{% load currency_filters i18n url_tags %}
3 3
 
4 4
 {% block tbody %}
5 5
 <tr>
@@ -57,7 +57,8 @@
57 57
 {% if status_url %}
58 58
     <tr>
59 59
         <td class="content-block">
60
-            {% blocktrans %}You can view the status of this order by clicking <a href="{{ status_url }}" title="order status">here</a>{% endblocktrans %}
60
+            {% absolute_url site.domain status_path as absolute_status_url %}
61
+            {% blocktrans %}You can view the status of this order by clicking <a href="{{ absolute_status_url }}" title="order status">here</a>{% endblocktrans %}
61 62
         </td>
62 63
     </tr>
63 64
 {% endif %}

+ 3
- 2
src/oscar/templates/oscar/communication/emails/commtype_order_placed_body.txt 查看文件

@@ -1,4 +1,4 @@
1
-{% load currency_filters i18n %}{% blocktrans with order_number=order.number %}Hello,
1
+{% load currency_filters i18n url_tags %}{% blocktrans with order_number=order.number %}Hello,
2 2
 
3 3
 We are pleased to confirm your order {{ order_number }} has been received and
4 4
 will be processed shortly.{% endblocktrans %}
@@ -17,8 +17,9 @@ will be processed shortly.{% endblocktrans %}
17 17
 {% endfor %}
18 18
 
19 19
 {% if status_url %}
20
+{% absolute_url site.domain status_path as absolute_status_url %}
20 21
 {% blocktrans %}You can view the status of this order at the below URL:
21
-{{ status_url }}{% endblocktrans %}
22
+{{ absolute_status_url }}{% endblocktrans %}
22 23
 {% endif %}
23 24
 
24 25
 {% blocktrans %}The team{% endblocktrans %}

Loading…
取消
儲存