1625, 1577, 1581

remotes/origin/stage6
Alexander Burdeiny 9 years ago
parent caf4edee38
commit f01418ce23
  1. 2
      core/simple_index_view.py
  2. 2
      emencia/django/newsletter/admin_forms.py
  3. 1
      emencia/django/newsletter/forms.py
  4. 85
      emencia/django/newsletter/mailer.py
  5. 17
      emencia/django/newsletter/models.py
  6. 61
      emencia/django/newsletter/templates/newsletter/AutomaticEmail.html
  7. 4
      emencia/django/newsletter/templates/newsletter/AutomaticEmail_test.html
  8. 582
      emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html
  9. 13
      functions/views_help.py
  10. 4
      proj/views.py
  11. 0
      static/newsletter/images/facebook.png
  12. 0
      static/newsletter/images/instagram.png
  13. 0
      static/newsletter/images/linkedin.png
  14. 0
      static/newsletter/images/twitter.png
  15. 0
      static/newsletter/images/vk.png
  16. 0
      static/newsletter/images/youtube.png
  17. 4
      templates/client/popups/announce_subscription.html
  18. 2
      templates/client/simple_pages/participation_landing.html

@ -56,7 +56,7 @@ class ParticipationViewLanding(JitterCacheMixin, MetadataMixin, FormView):
context = super(ParticipationViewLanding, self).get_context_data(**kwargs)
context['comments'] = ParticipationComment.objects.language().all()
context['articles'] = Article.objects.blogs().filter(theme__url='praktikum-eksponenta')[:4]
context['specialist_count'] = Contact.objects.all().count()
# context['specialist_count'] = Contact.objects.all().count()
return context

@ -194,7 +194,7 @@ class MailingListForm(forms.ModelForm):
class NewsletterForm(forms.ModelForm):
test_contacts = forms.ModelMultipleChoiceField(label=_(u'Тестовые контакты'), required=False,
queryset=Contact.objects.filter(tester=True))
content = forms.CharField(label=_('content'), widget=CKEditorWidget(config_name='newsletters'))
content = forms.CharField(label=_('content'), widget=CKEditorWidget(config_name='newsletters'), required=False)
content2 = forms.CharField(label=_('Content B'), widget=CKEditorWidget(config_name='newsletters'), required=False)
class Meta:

@ -175,6 +175,7 @@ class MailingSettingsForm(forms.ModelForm):
obj.r_cities = self.cleaned_data.get('r_cities') or []
obj.tags = self.cleaned_data.get('tg') or []
obj.themes = self.cleaned_data.get('th') or []
obj.from_users = False
obj.save()
return obj

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Mailer for emencia.django.newsletter"""
import os
import re
import sys
import time
@ -44,6 +45,10 @@ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.core.exceptions import SuspiciousOperation
from django.db.models import Q
from django.contrib.staticfiles import finders
from django.conf import settings
from sorl.thumbnail import get_thumbnail
from emencia.django.newsletter.models import Newsletter
from emencia.django.newsletter.models import ContactMailingStatus
@ -97,6 +102,26 @@ def decodestring(instring):
quopri.decode(StringIO(instring), outfile)
return outfile.getvalue()
dailymail_attahcments = {
'logo1': 'newsletter/images/logo1.png',
'logo2': 'newsletter/images/logo2.png',
'marker': 'newsletter/images/marker.png',
'calendar': 'newsletter/images/calendar.png',
'm1': 'newsletter/images/m1.png',
'expo': 'newsletter/images/expo.png',
'news2': 'newsletter/images/news2.jpg',
'b': 'newsletter/images/b.png',
'site_logo': 'newsletter/images/site_logo.png',
'instagram': 'newsletter/images/instagram.png',
'youtube': 'newsletter/images/youtube.png',
'facebook': 'newsletter/images/facebook.png',
'linkedin': 'newsletter/images/linkedin.png',
'vk': 'newsletter/images/vk.png',
'twitter': 'newsletter/images/twitter.png',
}
class NewsLetterSender(object):
def __init__(self, newsletter, test=False, verbose=0):
@ -151,13 +176,12 @@ class NewsLetterSender(object):
message_alt.attach(html)
message.attach(message_alt)
for attachment in self.attachments:
message.attach(attachment)
if announce_context:
if self.announce and announce_context:
# add announce attachments
announce_attachments = self.build_announce_attachments(announce_context)
announce_attachments = self.build_daily_ctx_attachments(announce_context)
for attachment in announce_attachments:
message.attach(attachment)
@ -205,6 +229,30 @@ class NewsLetterSender(object):
return attachments
def build_daily_ctx_attachments(self, context):
attachments = []
for obj in ['recommended', 'news', 'blog']:
_obj = context.get(obj)
if _obj:
msg_attachment = self.gen_attachment_logo(_obj, prefix=obj)
if msg_attachment:
attachments.append(msg_attachment)
for section in ['moscow', 'russia', 'foreign']:
_section = context.get(section)
if _section:
for event in _section:
prefix = '{}_{}_'.format(_section, event.object.event_type)
msg_attachment = self.gen_attachment_logo(event.object, prefix)
if msg_attachment:
attachments.append(msg_attachment)
return attachments
def build_daily_attachments(self):
attachments = []
for cid, path in dailymail_attahcments.iteritems():
attachments.append(self.gen_attachment_by_path(path, cid))
return attachments
def build_announce_attachments(self, context):
# todo: move hardcoded prefixes to setting (uses in templates)
conf = context.get('conf', [])
@ -231,6 +279,29 @@ class NewsLetterSender(object):
return attachments
def gen_attachment_by_path(self, path, cid):
try:
ctype, encoding = mimetypes.guess_type(path)
except SuspiciousOperation as e:
return None
if ctype is None or encoding is not None:
ctype = 'application/octet-stream'
maintype, subtype = ctype.split('/', 1)
try:
fd = open(os.path.join(settings.MEDIA_ROOT, path), 'rb')
if maintype == 'image':
message_attachment = MIMEImage(fd.read(), _subtype=subtype)
else:
message_attachment = MIMEBase(maintype, subtype)
message_attachment.set_payload(fd.read())
encode_base64(message_attachment)
except IOError as e:
return None
else:
fd.close()
message_attachment.add_header('Content-ID', '<{}>'.format(cid))
return message_attachment
def gen_attachment_logo(self, obj, prefix='logo_'):
logo = getattr(obj, 'logo')
if not logo:
@ -460,7 +531,10 @@ class Mailer(NewsLetterSender):
if not self.smtp:
self.smtp_connect()
self.attachments = self.build_attachments()
if self.newsletter.dailymail:
self.attachments = self.build_daily_attachments()
else:
self.attachments = self.build_attachments()
expedition_list = self.expedition_list
@ -491,6 +565,7 @@ class Mailer(NewsLetterSender):
message.as_string())
except (Exception, ) as e:
exception = e
print(exception)
log.info(u'Exception was raised while sending to {email}: {exception}'.format(
email=contact.email, exception=exception))
else:
@ -531,7 +606,7 @@ class Mailer(NewsLetterSender):
if self.credits <= 0:
return []
if self.newsletter.dailymail == True and not self.test:
if self.newsletter.dailymail and not self.test:
return self.newsletter.get_dailymail_subscribers()
qs = super(Mailer, self).expedition_list

@ -290,12 +290,15 @@ class Contact(models.Model):
areas_with_country.add(area)
f_countries.update(map(lambda x: x[0], group))
full_areas = areas.difference(areas_with_country)
params_list = []
if f_countries:
params_list.append(SQ(country_id__in=f_countries))
if full_areas:
params_list.append(SQ(area_id__in=full_areas))
foreign_sqs = SearchQuerySet().models(Exposition, Conference)\
.filter(
SQ(country_id__in=f_countries) |\
SQ(area_id__in=full_areas),
data_begin__gte=date)
.filter(data_begin__gte=date)
if params_list:
foreign_sqs = foreign_sqs.filter(reduce(operator.or_, params_list))
if th_tg_filter is not None:
foreign_sqs = foreign_sqs.filter(th_tg_filter)
ctx['foreign'] = foreign_sqs.order_by('data_begin')[:4]
@ -685,9 +688,11 @@ class Newsletter(models.Model):
periodic=Contact.PERIODIC_CHOICES.MONTH,
last_mailing_date=self.sending_date - month,
))
periodic_filter.append(Q(last_mailing_date__isnull=True))
qs = Contact.objects.subscribers().filter(
reduce(operator.or_, periodic_filter),
periodic_day=self.sending_date.isoweekday())
periodic_day=self.sending_date.isoweekday(),
from_users=False)
return qs

@ -57,11 +57,11 @@
<table border="0" cellspacing="0" cellpadding="0" style="width: 100%; background-color: #ffffff;">
<tr>
<td align="left" style="padding: 13px 0px 13px 24px;">
<img src="{% static 'newsletter/images/logo1.png' %}" alt="">
<img src="cid:logo1' %}" alt="">
</td>
<td align="right" style="padding: 13px 24px 13px 0px">
<img src="{% static 'newsletter/images/logo2.png' %}" alt="">
<img src="cid:logo2' %}" alt="">
</td>
</tr>
</table>
@ -84,16 +84,19 @@
<table>
<tr>
<td>
<img src="recommended_{{ recommended.object.pk }}"/>
{% comment %}
{% thumbnail obj.get_logo '281x225' as im %}
<img src="{{ im.url }}"/>
{% endthumbnail %}
{% endcomment %}
</td>
<td valign="top" align="left" style="width: 50%; padding-left: 22px;">
<table style="wigth: 100%;">
<tr>
<td valign="middle" style="color: #cc3399; font-size: 13px; text-transform: uppercase; padding: 3px 0px 3px 0px;">
<img src="{% static 'newsletter/images/marker.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 5px;">
<img src="cid:marker" alt="" style="display: inline-block; vertical-align: middle; margin-right: 5px;">
{{ obj.get_event_place_name }}
</td>
</tr>
@ -104,7 +107,7 @@
<tr>
<td style="color: #3399cc; font-size: 17px; padding: 3px 0px 3px 0px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="">
<img src="cid:calendar' %}" alt="">
{{ obj.get_dates }}, {{ obj.get_event_place_name }}
</td>
</tr>
@ -153,9 +156,12 @@
<table style="width: 100%; margin-top: 15px;">
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top">
<img src="moscow_{{ sqs_obj.object.event_type }}_{{ sqs_obj.object.pk }}" style="border: 1px solid #eaeaea;"/>
{% comment %}
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
{% endcomment %}
</td>
<td style="padding-left: 20px;">
<table style="width: 100%;">
@ -169,7 +175,7 @@
<tr>
<td style="color: #3399cc; font-size: 14px; padding-bottom: 3px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:calendar" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
@ -177,7 +183,7 @@
<tr>
<td style="color: #cc3399; font-size: 14px; padding-bottom: 5px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/marker.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:marker" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
@ -223,16 +229,19 @@
<table style="width: 100%; margin-top: 15px;">
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top">
<img src="russia_{{ sqs_obj.object.event_type }}_{{ sqs_obj.object.pk }}" style="border: 1px solid #eaeaea;"/>
{% comment %}
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
{% endcomment %}
</td>
<td style="padding-left: 20px;">
<table style="width: 100%;">
<tr>
<td class="color1" style="font-size: 14px; padding-bottom: 5px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/m1.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:m1' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
@ -248,7 +257,7 @@
<tr>
<td style="color: #3399cc; font-size: 14px; padding-bottom: 3px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:calendar" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
@ -296,15 +305,18 @@
<table style="width: 130px; margin: 0 auto;">
<tr>
<td style="padding-bottom: 15px;">
<img src="foreign_{{ sqs_obj.object.event_type }}_{{ sqs_obj.object.pk }}" style="border: 1px solid #eaeaea;"/>
{% comment %}
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
{% endcomment %}
</td>
</tr>
<tr>
<td class="color1" style="font-family: Arial, sans-serif; font-size: 13px; text-transform: uppercase; padding-bottom: 12px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/m1.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:m1" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
@ -314,7 +326,7 @@
</tr>
<tr>
<td style="color: #3399cc; font-size: 12px; padding-bottom: 5px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
<img src="cid:calendar" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
@ -343,7 +355,7 @@
{% endif %}
<table style="width: 100%; background-image: url({% static 'newsletter/images/b.png' %}); height: 129px">
<table style="width: 100%; background-image: url(cid:b.png); height: 129px">
<tr>
<td>
<table style="width: 100%;">
@ -367,7 +379,7 @@
<tr>
<td align="right" style="font-family: Arial, sans-serif; color: #ff8a00">
{% trans "Команда" %}<br>
<img src="{% static 'newsletter/images/expo.png' %}" alt="">
<img src="cid:expo" alt="">
</td>
</tr>
</table>
@ -387,10 +399,14 @@
<table style="width: 100%;">
<tr>
<td style="width: 300px; text-align: center; padding-bottom: 30px;">
<img src="cid:news{{ news.pk }}" alt="">
{% comment %}
{% thumbnail news.logo "272x195" as im %}
<img src="{{ im.url }}" alt="">
{% endthumbnail %}
<img src="{% static 'newsletter/images/news2.jpg' %}" alt="">
{% endcomment %}
<img src="cid:news2" alt="">
</td>
<td valign="top">
@ -400,7 +416,7 @@
</tr>
<tr>
<td valign="middle" style="color: #3399cc; font-size: 13px; padding-bottom: 8px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="margin-right: 4px;">
<img src="cid:calendar" alt="" style="margin-right: 4px;">
{# С 1 по 4 сентября #}
</td>
</tr>
@ -435,9 +451,12 @@
<table style="width: 100%;">
<tr>
<td style="width: 300px; text-align: center; padding-bottom: 40px;">
<img src="cid:blog{{ blog.pk }}" alt="">
{% comment %}
{% thumbnail blog.logo "272x195" as im %}
<img src="{{ im.url }}" alt="">
{% endthumbnail %}
{% endcomment %}
</td>
<td valign="top">
@ -473,12 +492,12 @@
</td>
<td align="center" style="padding-top: 20px; padding-bottom: 20px;">
<a href="#"><img src="{% static 'newsletter/images/s1.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/s2.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/s3.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/s4.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/s5.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/s6.png' %}" alt=""></a>
<a href="#"><img src="cid:instagram" alt=""></a>
<a href="#"><img src="cid:youtube" alt=""></a>
<a href="#"><img src="cid:facebook" alt=""></a>
<a href="#"><img src="cid:linkedin" alt=""></a>
<a href="#"><img src="cid:vk" alt=""></a>
<a href="#"><img src="cid:twitter" alt=""></a>
</td>
</tr>
</table>
@ -511,7 +530,7 @@
<td align="center" style="width: 50%; border-right: 1px solid #ff6900;">
<table>
<tr>
<td style="padding-bottom: 26px;"><img src="{% static 'newsletter/images/site_logo.png' %}" alt=""></td>
<td style="padding-bottom: 26px;"><img src="cid:site_logo" alt=""></td>
</tr>
<tr>

@ -15,10 +15,10 @@
<form action="." method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Сгенерировать</button>
<button type="submit">{% trans "Сгенерировать" %}</button>
</form>
{% if contact %}
{% include "newsletter/AutomaticEmail.html" %}
{% include "newsletter/AutomaticEmail_web.html" %}
{% endif %}
</body>
</html>

@ -0,0 +1,582 @@
{% load i18n %}
{% load static %}
{% load thumbnail %}
{# <a href="http://{{ domain }}{% url 'events:main' %}?{{ moscow_filter_url }}">{% trans "ПОСМОТРЕТЬ ВСЕ" %} ></a> #}
{# <a href="http://{{ domain }}{% url 'events:main' %}?{{ russia_filter_url }}">{% trans "ПОСМОТРЕТЬ ВСЕ" %} ></a> #}
{# <a href="http://{{ domain }}{% url 'events:main' %}?{{ foreign_filter_url }}">{% trans "ПОСМОТРЕТЬ ВСЕ" %} ></a> #}
{# <a href="http://{{ domain }}{% url 'newsletter-authmailingsettings' uidb36=uidb36 token=token %}">{% trans "НАСТРОИТЬ" %} ></a> #}
<style type="text/css" media="screen">
body{height:100%!important;margin:0;padding:0;width:100%!important;}
table{border-collapse:collapse;}
img,a img{border:0;outline:none;text-decoration:none;}
h1,h2,h3,h4,h5,h6{margin:0;padding:0;}
p{margin:0;padding:0;}
a{word-wrap:break-word;}
table,td{mso-table-lspace:0pt;mso-table-rspace:0pt;}
#outlook a{padding:0;}
img{-ms-interpolation-mode:bicubic;}
body,table,td,p,a,li,blockquote{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}
.hundered{width:100%!important;}
.tag{font-size: 13px; color: #999999;}
.tag:hover{text-decoration: none;}
.color1{color: #33ccff;}
.color2{color: #cc3399;}
.color3{color: #99cc66;}
.color4{color: #ff6600;}
@media screen and (max-width: 600px) {
.mobile100 {width:100% !important;}
}
@media screen and (max-width: 479px) {
.mobile_479_hide{display: none;}
.mobile_479_padding_none{padding-left: 10px !important; padding-right: 10px !important;}
}
</style>
<!-- BACKGROUND -->
<table border="0" cellspacing="0" style="width:100%; background-color: #ccc;">
<tr>
<td>&nbsp;</td>
</tr>
<tr class="mld-body mld-body-1">
<td align="center" valign="top">
<!-- LAOYUT BODY -->
<table border="0" cellspacing="0" cellpadding="0" style="width: 600px; font-family: Arial, sans-serif;">
<tr>
<td align="center" valign="top" style="background-color: #f8f8f6;">
<!-- PADDING LEFT&RIGHT -->
<table border="0" cellspacing="0" class="mld-element mld-container" style="width:100%;">
<tr>
<td align="left" valign="top" style="padding:0px 0px 0px 0px;">
<table border="0" cellspacing="0" cellpadding="0" style="width: 100%; background-color: #ffffff;">
<tr>
<td align="left" style="padding: 13px 0px 13px 24px;">
<img src="{% static 'newsletter/images/logo1.png' %}" alt="">
</td>
<td align="right" style="padding: 13px 24px 13px 0px">
<img src="{% static 'newsletter/images/logo2.png' %}" alt="">
</td>
</tr>
</table>
</td>
</tr>
</table>
{% if recommended %}
{% with recommended.object as obj %}
<!-- recommendation -->
<table border="0" cellspacing="0" style="width:100%;">
<tr>
<td align="center" style="padding:30px 23px 40px 23px;">
<table style="width: 100%;">
<tr>
<td align="center" style="color: #333333; font-size: 28px; font-weight: bold; text-transform: uppercase; padding-bottom: 15px;">{% trans "Самые важные события для вас" %}</td>
</tr>
</table>
<table>
<tr>
<td>
{% thumbnail obj.get_logo '281x225' as im %}
<img src="{{ im.url }}"/>
{% endthumbnail %}
</td>
<td valign="top" align="left" style="width: 50%; padding-left: 22px;">
<table style="wigth: 100%;">
<tr>
<td valign="middle" style="color: #cc3399; font-size: 13px; text-transform: uppercase; padding: 3px 0px 3px 0px;">
<img src="{% static 'newsletter/images/marker.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 5px;">
{{ obj.get_event_place_name }}
</td>
</tr>
<tr>
<td style="color: #333333; font-size: 25px; font-weight: bold; padding: 3px 0px 3px 0px;">{{ obj.name|safe }}</td>
</tr>
<tr>
<td style="color: #3399cc; font-size: 17px; padding: 3px 0px 3px 0px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="">
{{ obj.get_dates }}, {{ obj.get_event_place_name }}
</td>
</tr>
<tr>
<td style="color: #333333; font-size: 16px; padding: 3px 0px 3px 0px;">
{{ obj.main_title|safe }}
</td>
</tr>
<tr>
<td style="color: #999999; font-size: 13px; padding: 3px 0px 3px 0px;">
{% for tag in obj.tags %}
<a href="http://{{ domain }}{{ obj.catalog }}tag/{{ tag.url }}" class="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</td>
</tr>
<tr>
<td align="center" style="padding: 6px 0px 0px 0px;">
<a href="http://{{ domain }}{{ obj.get_permanent_url }}" style="display: inline-block; padding: 10px 30px; background-color: #ff6600; border-radius: 5px; text-transform: uppercase; color: #fff; text-decoration: none; font-size: 13px;">{% trans "посмотреть Подробнее" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endwith %}
{% endif %}
{% if moscow %}
<!-- Moscow -->
<table border="0" cellspacing="0" style="width:100%;">
<tr>
<td style="background-color: #ffffff; padding: 30px 23px 40px 23px;">
<table style="width: 100%;">
<tr>
<td align="center" style="color: #333333; font-size: 28px; font-weight: bold; text-transform: uppercase; padding-bottom: 15px;">{% trans "в москве" %}</td>
</tr>
</table>
{% for sqs_obj in moscow %}
{% with sqs_obj.object as obj %}
<table style="width: 100%; margin-top: 15px;">
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top">
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
</td>
<td style="padding-left: 20px;">
<table style="width: 100%;">
<tr>
<td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;">{{ obj.name|safe }}</td>
</tr>
<tr>
<td style="font-size: 14px; color: #999999; padding-bottom: 5px;">{{ obj.main_title|safe }}</td>
</tr>
<tr>
<td style="color: #3399cc; font-size: 14px; padding-bottom: 3px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
<tr>
<td style="color: #cc3399; font-size: 14px; padding-bottom: 5px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/marker.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
</tr>
<tr>
<td style="padding-bottom: 15px; padding-top: 10px;">
<a href="http://{{ domain }}{{ obj.get_permanent_url }}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "подробнее" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endwith %}
{% endfor %}
<table style="width: 100%;">
<tr>
<td align="center">
<a href="http://{{ domain }}{% url 'events:main' %}?{{ moscow_filter_url }}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ffffff; background-color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "посмотреть все" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endif %}
{% if russia %}
<!-- RF -->
<table border="0" cellspacing="0" style="width:100%;">
<tr>
<td style="background-color: #f8f8f6; padding: 30px 23px 40px 23px;">
<table style="width: 100%;">
<tr>
<td align="center" style="color: #333333; font-size: 28px; font-weight: bold; text-transform: uppercase; padding-bottom: 15px;">{% trans "В России" %}</td>
</tr>
</table>
{% for sqs_obj in russia %}
{% with sqs_obj.object as obj %}
<table style="width: 100%; margin-top: 15px;">
<tr {% if not forloop.last %}style="border-bottom: 1px solid #eaeaea;"{% endif %}>
<td valign="top">
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
</td>
<td style="padding-left: 20px;">
<table style="width: 100%;">
<tr>
<td class="color1" style="font-size: 14px; padding-bottom: 5px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/m1.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
</tr>
<tr>
<td style="color: #333333; text-transform: uppercase; font-size: 17px; font-weight: bold; padding-bottom: 5px;">{{ obj.name|safe }}</td>
</tr>
<tr>
<td style="font-size: 14px; color: #999999; padding-bottom: 5px;">{{ obj.main_title|safe }}</td>
</tr>
<tr>
<td style="color: #3399cc; font-size: 14px; padding-bottom: 3px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
<tr>
<td style="padding-bottom: 15px; padding-top: 10px;">
<a href="#" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "подробнее" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endwith %}
{% endfor %}
<table style="width: 100%;">
<tr>
<td align="center">
<a href="http://{{ domain }}{% url 'events:main' %}?{{ russia_filter_url }}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ffffff; background-color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "все события" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endif %}
{% if foreign %}
<!-- foreign -->
<table border="0" cellspacing="0" style="width:100%; background-color: #fff;">
<tr>
<td align="center" style="padding-top: 45px; padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 25px; color: #333333; text-transform: uppercase; font-weight: bold;">{% trans "За рубежом" %}</td>
</tr>
<tr>
<td>
<table style="width: 100%;">
<tr>
{% for sqs_obj in foreign %}
{% with sqs_obj.object as obj %}
<td>
<table style="width: 130px; margin: 0 auto;">
<tr>
<td style="padding-bottom: 15px;">
{% thumbnail obj.get_logo '109x114' as im %}
<img style="border: 1px solid #eaeaea;" src="{{ im.url }}"/>
{% endthumbnail %}
</td>
</tr>
<tr>
<td class="color1" style="font-family: Arial, sans-serif; font-size: 13px; text-transform: uppercase; padding-bottom: 12px;">
{% if obj.get_event_place_name %}
<img src="{% static 'newsletter/images/m1.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_event_place_name }}
{% endif %}
</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; color: #333333; font-size: 17px; font-weight: bold; padding-bottom: 10px;">{{ obj.name|safe }}</td>
</tr>
<tr>
<td style="color: #3399cc; font-size: 12px; padding-bottom: 5px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="display: inline-block; vertical-align: middle; margin-right: 4px;">
{{ obj.get_dates }}
</td>
</tr>
<tr>
<td style="font-size: 13px; color: #999999;">
{% for tag in obj.tags %}
<a href="http://{{ domain }}{{ obj.catalog }}tag/{{ tag.url }}" class="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</td>
</tr>
</table>
</td>
{% endwith %}
{% endfor %}
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" style="padding-top: 30px; padding-bottom: 40px;">
<a href="http://{{ domain }}{% url 'events:main' %}?{{ foreign_filter_url }}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ffffff; background-color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "Посмотреть все" %}</a>
</td>
</tr>
</table>
{% endif %}
<table style="width: 100%; background-image: url({% static 'newsletter/images/b.png' %}); height: 129px">
<tr>
<td>
<table style="width: 100%;">
<tr>
<td style="font-family: Arial, sans-serif; font-size: 19px; font-weight: bold; text-transform: uppercase; color: #ffffff;">{% trans "Снимаем всю гололвную боль" %}
</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; font-size: 15px; color: #ffffff;">{% blocktrans %}По организации участия в зарубежной <br> выставке{% endblocktrans %}</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; font-size: 14px; color: #333333; text-transform: uppercase; font-weight: bold;">{% trans "Отдыхайте, пока мы работаем!" %}</td>
</tr>
</table>
</td>
<td valign="bottom" align="right">
<table>
<tr>
<td align="right" style="font-family: Arial, sans-serif; color: #ff8a00">
{% trans "Команда" %}<br>
<img src="{% static 'newsletter/images/expo.png' %}" alt="">
</td>
</tr>
</table>
</td>
</tr>
</table>
{% if news %}
<!-- Новости событий -->
<table style="width: 100%;">
<tr>
<td align="center" style="padding-top: 40px; padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 30px; font-weight: bold; text-transform: uppercase; color: #333333">{% trans "Новости событий" %}</td>
</tr>
<tr>
<td>
<table style="width: 100%;">
<tr>
<td style="width: 300px; text-align: center; padding-bottom: 30px;">
{% thumbnail news.logo "272x195" as im %}
<img src="{{ im.url }}" alt="">
{% endthumbnail %}
<img src="{% static 'newsletter/images/news2.jpg' %}" alt="">
</td>
<td valign="top">
<table>
<tr>
<td style="padding-bottom: 8px; font-family: Arial, sans-serif; font-size: 17px; font-weight: bold; text-transform: uppercase; color: #333333;">{{ news.main_title|safe }}</td>
</tr>
<tr>
<td valign="middle" style="color: #3399cc; font-size: 13px; padding-bottom: 8px;">
<img src="{% static 'newsletter/images/calendar.png' %}" alt="" style="margin-right: 4px;">
{# С 1 по 4 сентября #}
</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; color: #999999; font-size: 13px; padding-bottom: 20px; line-height: 1.5;">{{ news.preview|safe }}</td>
</tr>
<tr>
<td>
<a href="http://{{ domain }}/news/" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "Все новости" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endif %}
<hr style="width: 565px; margin: 0 auto; background-color: #e6e6e5; height: 1px; border: 0;">
{% if blog %}
<!-- Новенькое из блога -->
<table style="width: 100%;">
<tr>
<td align="center" style="padding-top: 30px; padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 30px; font-weight: bold; text-transform: uppercase; color: #333333">{% trans "Новенькое из блога" %}</td>
</tr>
<tr>
<td>
<table style="width: 100%;">
<tr>
<td style="width: 300px; text-align: center; padding-bottom: 40px;">
{% thumbnail blog.logo "272x195" as im %}
<img src="{{ im.url }}" alt="">
{% endthumbnail %}
</td>
<td valign="top">
<table>
<tr>
<td style="padding-bottom: 15px; font-family: Arial, sans-serif; font-size: 17px; font-weight: bold; text-transform: uppercase; color: #333333">{{ blog.main_title|safe }}</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; color: #999999; font-size: 13px; padding-bottom: 20px; line-height: 1.5;">{{ blog.preview|safe }}</td>
</tr>
<tr>
<td>
<a href="http://{{ domain }}{{ blog.get_permanent_url }}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "посмотреть Подробнее" %}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endif %}
<!-- Ссылки на соцсети -->
<table width="100%" style="background-color: #ffffff;">
<tr>
<td align="center" style="width: 240px; font-family: Arial, sans-serif; font-size: 17px; font-weight: bold; color: #333333; text-transform: uppercase;">
{% trans "Следуйте за нами" %}:
</td>
<td align="center" style="padding-top: 20px; padding-bottom: 20px;">
<a href="#"><img src="{% static 'newsletter/images/instagram.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/youtube.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/facebook.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/linkedin.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/vk.png' %}" alt=""></a>
<a href="#"><img src="{% static 'newsletter/images/twitter.png' %}" alt=""></a>
</td>
</tr>
</table>
<!-- Управление подпиской -->
<table width="100%;">
<tr>
<td align="center" style="text-align: center; font-family: Arial, sans-serif; color: #333333; font-size: 17px; font-weight: bold; text-transform: uppercase; padding-top: 35px; padding-bottom: 20px;">{% trans "Управление подпиской:" %}</td>
</tr>
<tr>
<td align="center" style="font-family: Arial, sans-serif; color: #999999; font-size: 13px; padding-left: 30px; padding-right: 30px; padding-bottom: 20px;">{% trans "Вы можете настроить включение различных блоков информации в свое письмо, выбратьфильтры по темам, странам и городам, а также выбрать комфортную периодичность получения писем." %}</td>
</tr>
<tr>
<td align="center" style="padding-bottom: 35px; border-bottom: 1px solid #f3f3f3;">
<a href="{% if uidb36 and token %}http://{{ domain }}{% url 'newsletter-authmailingsettings' uidb36=uidb36 token=token %}{% endif %}" style="display: inline-block; padding: 7px 20px 7px 20px; border: 1px solid #ff6600; color: #ff6600; text-decoration: none; text-transform: uppercase; font-size: 12px; line-height: 12px; border-radius: 5px;">{% trans "Настроить" %}</a>
</td>
</tr>
</table>
<!-- Thanks -->
<table style="width: 100%; background-color: #ffffff;">
<tr>
<td style="padding-top: 26px; padding-bottom: 26px;">
<table>
<tr>
<td align="center" style="width: 50%; border-right: 1px solid #ff6900;">
<table>
<tr>
<td style="padding-bottom: 26px;"><img src="{% static 'newsletter/images/site_logo.png' %}" alt=""></td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; font-size: 18px; color: #333333"> {% trans "Хорошего Вам дня!" %} </td>
</tr>
</table>
</td>
<td style="padding-left: 20px; padding-right: 20px;">
<table>
<tr>
<td style="font-family: Arial, sans-serif; color: #333333; font-size: 14px; line-height: 1.5; padding-top: 10px;">
{% trans "Поисковик деловых событий" %} <br>
<a href="#" style="color: #ff6600;">expomap.ru</a> <br>
<a href="#" style="color: #ff6600;">mail@expomap.ru</a>
</td>
</tr>
<tr>
<td style="font-family: Arial, sans-serif; color: #333333; font-size: 14px; line-height: 1.5; padding-bottom: 10px;">
{% trans "По вопросам участия в выставках звоните" %}: <br>
+7 (499) 999 -12-07
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Menu -->
<table style="width: 100%; border-top: 1px solid #f3f3f3; border-bottom: 1px solid #f3f3f3;">
<tr>
<td style="padding-top: 15px; padding-bottom: 15px; padding-left: 15px;" align="center"><a href="#" style="font-size: 15px;color: #666666;">{% trans "Выставки" %}</a></td>
<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><a href="#" style="font-size: 15px;color: #666666;">{% trans "Конференции" %}</a></td>
<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><a href="#" style="font-size: 15px;color: #ff6600;">{% trans "Участие в выставках" %}</a></td>
<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><a href="#" style="font-size: 15px;color: #666666;">{% trans "Новости" %}</a></td>
<td style="padding-top: 15px; padding-bottom: 15px; padding-right: 15px;" align="center"><a href="#" style="font-size: 15px;color: #666666;">{% trans "Статьи" %}</a></td>
</tr>
</table>
<!-- footer -->
<table style="width: 100%; background-color: #ffffff;">
<tr>
<td style="padding-top: 35px; padding-left: 20px; padding-right: 20px; font-family: Arial, sans-serif; font-size: 13px; color: #999999; padding-bottom: 7px;" align="center">{% trans "Вы получили это письмо, так как подписаны на рассылку" %} <a href="#" style="color: #ff6600;">https://www.expomap.ru</a></td>
</tr>
<tr>
<td align="center" style="font-family: Arial, sans-serif; font-size: 13px; color: #999999; padding-bottom: 7px;"><a href="#" style="color: #ff6600;">{% trans "Переслать другу" %}</a> {% trans "или" %} <a href="#" style="color: #ff6600;">{% trans "Отписаться" %}</a></td>
</tr>
<tr>
<td align="center" style="padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 13px; color: #999999;">&copy; 2008 — 2016 Expomap.ru</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
import re
import datetime
from django.shortcuts import get_object_or_404
from django.core.cache import cache
from accounts.models import User
from emencia.django.newsletter.models import Contact
def get_referer(request, default=None):
referer = request.META.get('HTTP_REFERER')
@ -39,3 +44,11 @@ def get_user(url):
except ValueError:
user = get_object_or_404(User, url=url)
return user
def get_subscribers_count():
key = 'contact_count'
count = cache.get(key)
if count is None:
count = Contact.objects.valid_subscribers().filter(from_users=False).count()
cache.set(key, count, datetime.timedelta(days=1).total_seconds())
return count

@ -4,9 +4,12 @@ from django.template import RequestContext
from django.views.generic import TemplateView
from django.conf import settings
from django.utils.translation import get_language
from functions.cache_mixin import JitterCacheMixin
from functions.forms import ThemeSearch
from functions.search_forms import ExpositionSearchForm
from functions.views_help import get_subscribers_count
from accounts.forms import RegistrationCompleteForm, SocialRegistrationCompleteForm
from meta.models import SeoText
from theme.models import Theme
@ -46,6 +49,7 @@ def expo_context(request):
'seo_text': add_seo(request), 'announce_subscribe': SubscribeAssideForm(),
'NO_EXTERNAL_JS': getattr(settings, 'NO_EXTERNAL_JS', False),
'NO_BANNERS': getattr(settings, 'NO_BANNERS', False),
'SUBSCRIBERS_COUNT': get_subscribers_count(),
}
user = request.user

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -18,9 +18,7 @@
<div class="pw-body clearfix">
<div class="step1" >
<div class="label">
<p>
{% trans 'Более <b>40 000 профессионалов</b> получают наши анонсы событий каждую среду. Присоединяйтесь!' %}
</p>
<p>{% blocktrans with count=SUBSCRIBERS_COUNT %}Более <b>{{ count }} профессионалов</b> получают наши анонсы событий каждую среду. Присоединяйтесь!{% endblocktrans %}</p>
</div>
<form action="{% if not themes %}/newsletters/{% else %}/newsletters/popup/validate/{% endif %}" id="subscribe-form" class="pw-form{% if themes %} simple-validate{% endif %}">

@ -314,7 +314,7 @@
</div>
<button type="submit">{% trans "Подписаться" %}</button>
</form>
<p>{% blocktrans with specialist_count=specialist_count %}Нас читают уже <span>{{ specialist_count }}</span> специалиста!{% endblocktrans %}</p>
<p>{% blocktrans with count=SUBSCRIBERS_COUNT %}Нас читают уже <span>{{ count }}</span> специалиста!{% endblocktrans %}</p>
</div>
</footer>

Loading…
Cancel
Save