Pārlūkot izejas kodu

Added additional variable for linking to static assets in HTML emails

master
David Winterbottom 13 gadus atpakaļ
vecāks
revīzija
605a35e180

+ 5
- 0
oscar/apps/customer/abstract_models.py Parādīt failu

2
 from django.utils.translation import ugettext_lazy as _
2
 from django.utils.translation import ugettext_lazy as _
3
 from django.template import Template, Context, TemplateDoesNotExist
3
 from django.template import Template, Context, TemplateDoesNotExist
4
 from django.template.loader import get_template
4
 from django.template.loader import get_template
5
+from django.conf import settings
5
 
6
 
6
 from oscar.apps.customer.managers import CommunicationTypeManager
7
 from oscar.apps.customer.managers import CommunicationTypeManager
7
 
8
 
70
         """
71
         """
71
         if ctx is None:
72
         if ctx is None:
72
             ctx = {}
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
         code = self.code.lower()
78
         code = self.code.lower()
74
         # Build a dict of message name to Template instance
79
         # Build a dict of message name to Template instance
75
         templates = {'subject': 'email_subject_template',
80
         templates = {'subject': 'email_subject_template',

+ 1
- 1
oscar/management/commands/oscar_generate_email_content.py Parādīt failu

21
             raise CommandError("No order found with number %s" % args[1])
21
             raise CommandError("No order found with number %s" % args[1])
22
         
22
         
23
         messages = CommunicationEventType.objects.get_and_render(args[0], {'order': order})
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
             messages['subject'], messages['body'], messages['html'])
25
             messages['subject'], messages['body'], messages['html'])

Notiek ielāde…
Atcelt
Saglabāt