Пример #1
0
 def get_mime_html(self, drip, user):
     drip_message = message_class_for(drip.message_class, )(drip.drip, user)
     if drip_message.message.alternatives:
         return self.get_mime_html_from_alternatives(
             drip_message.message.alternatives)
     html = drip_message.message.body
     mime = 'text/plain'
     return html, mime
Пример #2
0
    def view_drip_email(self, request, drip_id, into_past, into_future, user_id):
        from django.shortcuts import render, get_object_or_404
        from django.http import HttpResponse
        drip = get_object_or_404(Drip, id=drip_id)
        user = get_object_or_404(User, id=user_id)
        drip_message = message_class_for(drip.message_class)(drip.drip, user)

        html = ''
        for body, mime in drip_message.message.alternatives:
            if mime == 'text/html':
                html = body

        return HttpResponse(html)
Пример #3
0
    def view_drip_email(self, request, drip_id, into_past, into_future, user_id):
        from django.shortcuts import render, get_object_or_404
        from django.http import HttpResponse
        drip = get_object_or_404(Drip, id=drip_id)
        user = get_object_or_404(User, id=user_id)
        drip_message = message_class_for(drip.message_class)(drip.drip, user)

        html = ''
        for body, mime in drip_message.message.alternatives:
            if mime == 'text/html':
                html = body

        return HttpResponse(html)
Пример #4
0
    def view_drip_email(self, request, drip_id, into_past, into_future, user_id):
        from django.shortcuts import render, get_object_or_404
        from django.http import HttpResponse
        drip = get_object_or_404(Drip, id=drip_id)

        if isinstance(User, six.string_types):
            app_label, model_name = User.split('.')
            UserModel = models.get_model(app_label, model_name)

        user = get_object_or_404(UserModel, id=user_id)
        drip_message = message_class_for(drip.message_class)(drip.drip, user)

        html = ''
        for body, mime in drip_message.message.alternatives:
            if mime == 'text/html':
                html = body

        return HttpResponse(html)
Пример #5
0
    def view_drip_email(self, request, drip_id, into_past, into_future, user_id):
        drip = get_object_or_404(Drip, id=drip_id)
        User = get_user_model()
        user = get_object_or_404(User, id=user_id)

        drip_message = message_class_for(drip.message_class)(drip.drip, user)
        html = ''
        mime = ''
        if drip_message.message.alternatives:
            for body, mime in drip_message.message.alternatives:
                if mime == 'text/html':
                    html = body
                    mime = 'text/html'
        else:
            html = drip_message.message.body
            mime = 'text/plain'

        return HttpResponse(html, content_type=mime)
Пример #6
0
    def view_drip_email(self, request, drip_id, into_past, into_future, user_id):
        from django.shortcuts import get_object_or_404
        from django.http import HttpResponse
        drip = get_object_or_404(Drip, id=drip_id)
        User = get_user_model()
        user = get_object_or_404(User, id=user_id)

        drip_message = message_class_for(drip.message_class)(drip.drip, user)
        html = ''
        mime = ''
        if drip_message.message.alternatives:
            for body, mime in drip_message.message.alternatives:
                if mime == 'text/html':
                    html = body
                    mime = 'text/html'
        else:
            html = drip_message.message.body
            mime = 'text/plain'

        return HttpResponse(html, content_type=mime)
Пример #7
0
 def get_mime_html_for_sms(self, drip, user):
     drip_message = message_class_for(drip.message_class, )(drip.drip, user)
     html = drip_message.sms
     mime = 'text/plain'
     return html, mime