Пример #1
0
def view_email(request, slug):
    """
    Render the specified newsletter email for users who can't view
    HTML emails on their mail clients.
    """
    email = get_object_or_404(Email, slug=slug)
    html_template, text_template = email.newsletter.get_templates()
    recipient = request.user.profile.get_full_name_or_username()

    # Construct the email
    email_context = Context({ 'email': email,
                            'recipient': recipient })
    text_content, html_content = render_email(email_context,
                                              text_template,
                                              html_template)
    return HttpResponse(html_content)