diff --git a/exposition/models.py b/exposition/models.py index 09999242..1171f42d 100644 --- a/exposition/models.py +++ b/exposition/models.py @@ -368,6 +368,7 @@ class Paid(models.Model): oficial_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_oficial') participation_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_participation') tickets_link = models.ForeignKey('banners.Redirect', null=True, blank=True, related_name='expo_tickets') + organiser = models.EmailField(blank=True) pre_save.connect(pre_save_handler, sender=Exposition) diff --git a/exposition/urls.py b/exposition/urls.py index 4cb8b972..2c1743f6 100644 --- a/exposition/urls.py +++ b/exposition/urls.py @@ -63,6 +63,7 @@ urlpatterns = patterns('', url(r'^expo/tag/(?P.*)/(?P\d+)/$', ExpoTagCatalog.as_view(), {'meta_id':15}), url(r'^expo/tag/(?P.*)/$', ExpoTagCatalog.as_view(), {'meta_id':14}), # expo additional pages + url(r'^expo/(?P.*)/send_to_organiser/$', 'exposition.views.send_to_organiser'), url(r'^expo/(?P.*)/statistic/$', ExpositionStatistic.as_view(), {'meta_id':60}), url(r'^expo/(?P.*)/price/$', ExpositionPrice.as_view(), {'meta_id':61}), url(r'^expo/(?P.*)/program/$', ExpositionProgramme.as_view(), {'meta_id':62}), diff --git a/exposition/views.py b/exposition/views.py index bd8f33c2..43bdda07 100644 --- a/exposition/views.py +++ b/exposition/views.py @@ -507,3 +507,20 @@ def add_note(request, slug): args['success'] = True return HttpResponse(json.dumps(args), content_type='application/json') + +from django.core.mail import send_mail +from django.core.mail import EmailMessage +def send_to_organiser(request, slug): + exposition = get_object_or_404(Exposition, url=slug) + mail_send = exposition.paid.organiser + name = request.POST.get('person_inf') + email = request.POST.get('person') + phone = request.POST.get('phone', '') + question = request.POST.get('question', '') + text = u"выставка: %s\n Контактное лицо:%s\nEmail: %s\nтелефон:%s\n вопрос:%s"%(exposition.name, name, email, + phone, question) + msg = EmailMessage(u'Проплаченная выставка', text, settings.DEFAULT_FROM_EMAIL, [mail_send]) + msg.content_subtype = "html" + msg.send() + return HttpResponseRedirect('%sservice/thanks/'%exposition.get_permanent_url()) + diff --git a/templates/client/popups/issue_organizer.html b/templates/client/popups/issue_organizer.html index 2cbbcd8c..82b02758 100644 --- a/templates/client/popups/issue_organizer.html +++ b/templates/client/popups/issue_organizer.html @@ -11,7 +11,7 @@ Оставьте свои контакты и вопрос, и мы направим его организатору EXPONAME

-
+ {% csrf_token %}