Переглянути джерело

Added additional variable for linking to static assets in HTML emails

master
David Winterbottom 13 роки тому
джерело
коміт
605a35e180

+ 5
- 0
oscar/apps/customer/abstract_models.py Переглянути файл

@@ -2,6 +2,7 @@ from django.db import models
2 2
 from django.utils.translation import ugettext_lazy as _
3 3
 from django.template import Template, Context, TemplateDoesNotExist
4 4
 from django.template.loader import get_template
5
+from django.conf import settings
5 6
 
6 7
 from oscar.apps.customer.managers import CommunicationTypeManager
7 8
 
@@ -70,6 +71,10 @@ class AbstractCommunicationEventType(models.Model):
70 71
         """
71 72
         if ctx is None:
72 73
             ctx = {}
74
+
75
+        # Pass base URL for serving images within HTML emails
76
+        ctx['static_base_url'] = getattr(settings, 'OSCAR_STATIC_BASE_URL', None)
77
+
73 78
         code = self.code.lower()
74 79
         # Build a dict of message name to Template instance
75 80
         templates = {'subject': 'email_subject_template',

+ 1
- 1
oscar/management/commands/oscar_generate_email_content.py Переглянути файл

@@ -21,5 +21,5 @@ class Command(BaseCommand):
21 21
             raise CommandError("No order found with number %s" % args[1])
22 22
         
23 23
         messages = CommunicationEventType.objects.get_and_render(args[0], {'order': order})
24
-        print "Subject: %s\nBody:\n\n%sBody HTML:\n\n%s"% (
24
+        print "Subject: %s\nBody:\n\n%s\nBody HTML:\n\n%s"% (
25 25
             messages['subject'], messages['body'], messages['html'])

Завантаження…
Відмінити
Зберегти