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.
 
 
 
 
 
 

46 lines
2.0 KiB

# -*- coding: utf-8 -*-
import json
from django.views.generic import TemplateView
from django.core.mail import EmailMessage
from django.http import HttpResponse
from django.conf import settings
from django.utils.translation import ugettext as _
class SeminarLendingView(TemplateView):
template_name = 'client/simple_pages/expo_seminar.html'
def send_to_organiser(request):
mail_send = 'expomap@mail.ru'
data = {
'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', ''),
'phone': request.POST.get('phone', ''),
}
title = request.POST.get('type', '')
text = _(u"""Имя: %(fname)s;
Фамилия:%(lname)s;
Email: %(email)s;
Телефон: %(phone)s;
компния: %(company)s;
должность: %(office)s""") % data
msg = EmailMessage(title, text, settings.DEFAULT_FROM_EMAIL, [mail_send])
msg.content_subtype = "html"
msg.send()
redirect_to = '/service/thanks/'
if title.endswith(u'семинар'):
message = _(u"""Мы получили Ваш запрос и очень рады, что Вам интересно участие в семинаре Expomap. Если места еще есть, мы пришлем Вам приглашение на указанную Вами электронную почту.
Увидимся на welcome-coffee ☺""")
else:
message = _(u"""Благодарим за интерес к нашему семинару! За несколько дней до мероприятия мы пришлем Вам ссылку для подключения к онлайн-трансляции!""")
return HttpResponse(json.dumps({'success':True, 'redirect_to': redirect_to, 'message': message}), content_type='application/json')