Beispiel #1
0
def my_mails_intern(request, mail_url, error_message=None):
    renderdict = get_menu_dict(request)
    renderdict.update({
        'recipient_type':
        request.POST.get('recipient_type'),
        'recipient_type_detail':
        request.POST.get('recipient_type_detail'),
        'recipients':
        request.POST.get('recipients'),
        'recipients_count':
        int(request.POST.get('recipients_count') or 0),
        'filter_value':
        request.POST.get('filter_value'),
        'mail_subject':
        request.POST.get('subject'),
        'mail_message':
        request.POST.get('message'),
        'mail_url':
        mail_url,
        'email':
        request.user.member.email,
        'error_message':
        error_message,
        'templates':
        MailTemplateDao.all_templates(),
        'can_use_general_email':
        request.user.has_perm('juntagrico.can_use_general_email'),
        'can_load_templates':
        request.user.has_perm('juntagrico.can_load_templates')
    })
    return render(request, 'mail_sender.html', renderdict)
Beispiel #2
0
def get_mail_template(request, template_id):
    renderdict = {}
    template = MailTemplateDao.template_by_id(template_id)
    exec(template.code)
    t = Template(template.template)
    c = Context(renderdict)
    result = t.render(c)
    return HttpResponse(result)