コード例 #1
0
 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')
コード例 #2
0
 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')
コード例 #3
0
 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))
コード例 #4
0
 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))
コード例 #5
0
ファイル: admin.py プロジェクト: garromark/django-newsletter
    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')
コード例 #6
0
    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')
コード例 #7
0
    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))