def preview_text(self, request, object_id): message = self._getobj(request, object_id) (subject_template, text_template, html_template) = EmailTemplate.get_templates('message', message.newsletter) c = Context({'message' : message, 'site' : Site.objects.get_current(), 'newsletter' : message.newsletter, 'date' : datetime.now()}) return HttpResponse(text_template.render(c), mimetype='text/plain')
def preview_html(self, request, object_id): message = self._getobj(request, object_id) (subject_template, text_template, html_template) = EmailTemplate.get_templates('message', message.newsletter) if not html_template: raise Http404(_('No HTML template associated with the newsletter this message belongs to.')) c = Context({'message' : message, 'site' : Site.objects.get_current(), 'newsletter' : message.newsletter, 'date' : datetime.now()}) return HttpResponse(html_template.render(c))
def preview_text(self, request, object_id): message = self._getobj(request, object_id) (subject_template, text_template, html_template) = \ EmailTemplate.get_templates('message', message.newsletter) c = Context({'message' : message, 'site' : Site.objects.get_current(), 'newsletter' : message.newsletter, 'date' : datetime.now(), 'STATIC_URL': settings.STATIC_URL, 'MEDIA_URL': settings.MEDIA_URL}, autoescape=False) return HttpResponse(text_template.render(c), mimetype='text/plain')
def preview_text(self, request, object_id): submission = self._getobj(request, object_id) (subject_template, text_template, html_template) = \ EmailTemplate.get_templates('message', submission.newsletter) c = Context( { 'site': Site.objects.get_current(), 'newsletter': submission.newsletter, 'date': datetime.now(), 'STATIC_URL': settings.STATIC_URL, 'MEDIA_URL': settings.MEDIA_URL }, autoescape=False) return HttpResponse(text_template.render(c), mimetype='text/plain')
def preview_html(self, request, object_id): submission = self._getobj(request, object_id) (subject_template, text_template, html_template) = \ EmailTemplate.get_templates('message', submission.newsletter) if not html_template: raise Http404( _('No HTML template associated with the newsletter this message belongs to.' )) c = Context({ 'site': Site.objects.get_current(), 'newsletter': submission.newsletter, 'date': datetime.now(), 'STATIC_URL': settings.STATIC_URL, 'MEDIA_URL': settings.MEDIA_URL }) return HttpResponse(html_template.render(c))