You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

import json
from django.views.generic import TemplateView
from django.core.mail import EmailMessage
from django.http import HttpResponse
from django.conf import settings
class SeminarLendingView(TemplateView):
template_name = 'client/simple_pages/expo_seminar.html'
def send_to_organiser(request):
mail_send = 'pavel.handleman@gmail.com'
fname = request.POST.get('name')
lname = request.POST.get('surname')
email = request.POST.get('email', '')
company = request.POST.get('company', '')
office = request.POST.get('office', '')
title = request.POST.get('type', '')
text = """Имя: %s;
Фамилия:%s;
Email: %s;
телефон:%s;
компния:%s;
должность: %s"""%(fname, lname, email, company, office)
msg = EmailMessage(title, text, settings.DEFAULT_FROM_EMAIL, [mail_send])
msg.content_subtype = "html"
msg.send()
redirect_to = '/service/thanks/'
return HttpResponse(json.dumps({'success':True, 'redirect_to': redirect_to}), content_type='application/json')