1577 натянул верстку письма

remotes/origin/stage6
Alexander Burdeiny 9 years ago
parent 11cb733b40
commit caf4edee38
  1. 35
      emencia/django/newsletter/forms.py
  2. 34
      emencia/django/newsletter/models.py
  3. 603
      emencia/django/newsletter/templates/newsletter/AutomaticEmail.html
  4. 31
      emencia/django/newsletter/templates/newsletter/AutomaticEmail_test.html
  5. 72
      events/forms.py
  6. 7
      functions/model_mixin.py
  7. BIN
      static/newsletter/images/b.png
  8. BIN
      static/newsletter/images/calendar.png
  9. BIN
      static/newsletter/images/expo.png
  10. BIN
      static/newsletter/images/img.jpg
  11. BIN
      static/newsletter/images/img2.png
  12. BIN
      static/newsletter/images/logo1.png
  13. BIN
      static/newsletter/images/logo2.png
  14. BIN
      static/newsletter/images/m1.png
  15. BIN
      static/newsletter/images/m2.png
  16. BIN
      static/newsletter/images/m3.png
  17. BIN
      static/newsletter/images/m4.png
  18. BIN
      static/newsletter/images/marker.png
  19. BIN
      static/newsletter/images/marker2.png
  20. BIN
      static/newsletter/images/news.jpg
  21. BIN
      static/newsletter/images/news2.jpg
  22. BIN
      static/newsletter/images/s1.png
  23. BIN
      static/newsletter/images/s2.png
  24. BIN
      static/newsletter/images/s3.png
  25. BIN
      static/newsletter/images/s4.png
  26. BIN
      static/newsletter/images/s5.png
  27. BIN
      static/newsletter/images/s6.png
  28. BIN
      static/newsletter/images/site_logo.png

@ -77,46 +77,12 @@ class CustomModelChoiceIterator(ModelChoiceIterator):
class ML_ModelMultipleChoiceField(forms.ModelMultipleChoiceField):
''' use it with field.queryset = Model.objects.none()
'''
def _get_choices(self):
# If self._choices is set, then somebody must have manually set
# the property self.choices. In this case, just return self._choices.
if hasattr(self, '_choices'):
return self._choices
# Otherwise, execute the QuerySet in self.queryset to determine the
# choices dynamically. Return a fresh ModelChoiceIterator that has not been
# consumed. Note that we're instantiating a new ModelChoiceIterator *each*
# time _get_choices() is called (and, thus, each time self.choices is
# accessed) so that we can ensure the QuerySet has not been consumed. This
# construct might look complicated but it allows for lazy evaluation of
# the queryset.
return CustomModelChoiceIterator(self)
choices = property(_get_choices, forms.ChoiceField._set_choices)
# def clean(self, value):
# if self.required and not value:
# raise ValidationError(self.error_messages['required'])
# elif not self.required and not value:
# return self.queryset.none()
# if not isinstance(value, (list, tuple)):
# raise ValidationError(self.error_messages['list'])
# key = self.to_field_name or 'pk'
# qs = self.queryset.filter(**{'%s__in' % key: value})
# pks = set([force_text(getattr(o, key)) for o in qs])
# for val in value:
# if force_text(val) not in pks:
# raise ValidationError(self.error_messages['invalid_choice'] % val)
# # Since this overrides the inherited ModelChoiceField.clean
# # we run custom validators here
# self.run_validators(value)
# return qs
class MailingSettingsForm(forms.ModelForm):
r_cities = ML_ModelMultipleChoiceField(
label=_(u'Города России'), required=False,
@ -138,7 +104,6 @@ class MailingSettingsForm(forms.ModelForm):
model = Contact
fields = [
'moscow', 'russia', 'r_cities', 'foreign',
# 'tags', 'themes',
'periodic', 'periodic_day', 'content_news', 'content_overview',
'content_articles',
]

@ -7,7 +7,7 @@ from datetime import timedelta
from dateutil import relativedelta
from email.MIMEImage import MIMEImage
from random import choice
from itertools import chain
from itertools import chain, groupby
import copy
import operator
@ -234,8 +234,8 @@ class Contact(models.Model):
paid_recommend = NewsletterRecommend.objects.filter(
fr__gte=date,
to__lte=date)
recommended = RelatedSearchQuerySet().models(Exposition, Conference)\
.filter(expohit=True)
recommended = SearchQuerySet().models(Exposition, Conference)\
.filter(expohit=True, data_begin__gte=date)
if th_tg_filter:
paid_recommend = list(paid_recommend.filter(theme__in=th_tg_structure.keys()))
recommended = recommended.filter(th_tg_filter)
@ -249,7 +249,7 @@ class Contact(models.Model):
# moscow
if self.moscow:
moscow_sqs = RelatedSearchQuerySet().models(Exposition, Conference)\
moscow_sqs = SearchQuerySet().models(Exposition, Conference)\
.filter(city_id=Exact(settings.MOSCOW_PK), data_begin__gte=date)
if th_tg_filter is not None:
moscow_sqs = moscow_sqs.filter(th_tg_filter)
@ -258,14 +258,14 @@ class Contact(models.Model):
moscow_filter_url.setlist('theme', th_tg_structure.keys())
moscow_filter_url.setlist('tag', list(chain(th_tg_structure.values())))
moscow_filter_url['city'] = settings.MOSCOW_PK
# moscow_filter_url['date_from'] = date.strftime('%d.%m.%Y')
moscow_filter_url['date_from'] = date.strftime('%d.%m.%Y')
ctx['moscow_filter_url'] = mark_safe(moscow_filter_url.urlencode())
# russia
if self.russia:
r_cities = set(self.r_cities.values_list('pk', flat=True))
r_date = date + relativedelta.relativedelta(months=1)
russia_sqs = RelatedSearchQuerySet().models(Exposition, Conference)\
russia_sqs = SearchQuerySet().models(Exposition, Conference)\
.filter(country_id=Exact(settings.RUSSIA_PK), data_begin__gte=r_date)\
.exclude(city_id=Exact(settings.MOSCOW_PK))
if r_cities:
@ -277,14 +277,25 @@ class Contact(models.Model):
russia_filter_url.setlist('theme', th_tg_structure.keys())
russia_filter_url.setlist('tag', list(chain(th_tg_structure.values())))
russia_filter_url['country'] = settings.RUSSIA_PK
# russia_filter_url['date_from'] = r_date.strftime('%d.%m.%Y')
russia_filter_url['date_from'] = r_date.strftime('%d.%m.%Y')
ctx['russia_filter_url'] = mark_safe(russia_filter_url.urlencode())
# foreign
if self.foreign:
f_countries = set(self.f_countries.values_list('pk', flat=True))
foreign_sqs = RelatedSearchQuerySet().models(Exposition, Conference)\
.filter(country_id__in=f_countries, data_begin__gte=date)
f_countries_cleaned = list(self.f_countries.order_by('pk').values_list('pk', 'area_id'))
areas = set(self.area.order_by('pk').values_list('pk', flat=True))
areas_with_country = set()
f_countries = set()
for area, group in groupby(f_countries_cleaned, lambda x: x[1]):
areas_with_country.add(area)
f_countries.update(map(lambda x: x[0], group))
full_areas = areas.difference(areas_with_country)
foreign_sqs = SearchQuerySet().models(Exposition, Conference)\
.filter(
SQ(country_id__in=f_countries) |\
SQ(area_id__in=full_areas),
data_begin__gte=date)
if th_tg_filter is not None:
foreign_sqs = foreign_sqs.filter(th_tg_filter)
ctx['foreign'] = foreign_sqs.order_by('data_begin')[:4]
@ -292,7 +303,7 @@ class Contact(models.Model):
foreign_filter_url.setlist('theme', th_tg_structure.keys())
foreign_filter_url.setlist('tag', list(chain(th_tg_structure.values())))
foreign_filter_url.setlist('country', f_countries)
# foreign_filter_url['date_from'] = date.strftime('%d.%m.%Y')
foreign_filter_url['date_from'] = date.strftime('%d.%m.%Y')
ctx['foreign_filter_url'] = mark_safe(foreign_filter_url.urlencode())
# news
@ -315,6 +326,7 @@ class Contact(models.Model):
except:
pass
# import pdb; pdb.set_trace()
return ctx
def get_announce_context(self):

@ -1,25 +1,582 @@
{% load i18n %}
{% load static %}
{% load thumbnail %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="language" content="{{ LANGUAGE_CODE }}" />
<meta name="description" content="{% block meta-description %}Emencia Django Newsletter for sending newsletter.{% endblock %}" />
<meta name="author" content="Fantomas42" />
<title>{% trans "Emencia Django Newsletter" %} - {% block title %}{% endblock %}</title>
</head>
<body>
<h1>{% trans "Emencia Django Newsletter" %}</h1>
{% block test_form %}
{% endblock test_form %}
{% block content %}
<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="{% if uidb36 and token %}http://{{ domain }}{% url 'newsletter-authmailingsettings' uidb36=uidb36 token=token %}{% else %}#{% endif %}">{% trans "НАСТРОИТЬ" %} ></a>
{% endblock %}
</body>
</html>
{# <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/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>
</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,10 +1,25 @@
{% extends "newsletter/AutomaticEmail.html" %}
{% load i18n %}
{% block test_form %}
<form action="." method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Сгенерировать</button>
</form>
{% endblock test_form %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="language" content="{{ LANGUAGE_CODE }}" />
<meta name="description" content="{% block meta-description %}Emencia Django Newsletter for sending newsletter.{% endblock %}" />
<meta name="author" content="Fantomas42" />
<title>{% trans "Emencia Django Newsletter" %} - {% block title %}{% endblock %}</title>
</head>
<body>
<h1>{% trans "Emencia Django Newsletter" %}</h1>
<form action="." method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Сгенерировать</button>
</form>
{% if contact %}
{% include "newsletter/AutomaticEmail.html" %}
{% endif %}
</body>
</html>

@ -212,6 +212,7 @@ def check_year(value):
class FilterForm(forms.Form):
_month_choices = None
_month = None
_date_begin_sqs_params = None
event_type = FilterTypedMultipleChoiceField(
label=_(u'Тип события'), coerce=int,
@ -1017,42 +1018,43 @@ class FilterForm(forms.Form):
return year, month
def make_date_begin_sqs_params(self):
periods = []
self.checked_monthes = {}
cleaned_periods = self.get_date_begin_periods()
# print(cleaned_periods)
date_range = self.get_date_from_to_range()
if date_range is not None:
periods.append(date_range)
else:
for year, monthes in cleaned_periods.iteritems():
for month in monthes:
if month in self.checked_monthes.get(year, []):
continue
start_year, start_month = self.get_start_of_period(year, cleaned_periods, month)
end_year, end_month = self.get_end_of_period(year, cleaned_periods, month)
_first_day, _last_day = calendar.monthrange(end_year, end_month)
periods.append((
date.today().replace(day=1, month=start_month, year=start_year),
date.today().replace(day=_last_day, month=end_month, year=end_year)
))
if not monthes:
start_year, start_month = self.get_start_of_period(year, cleaned_periods)
end_year, end_month = self.get_end_of_period(year, cleaned_periods)
_first_day, _last_day = calendar.monthrange(end_year, end_month)
periods.append((
date.today().replace(day=1, month=start_month, year=start_year),
date.today().replace(day=_last_day, month=end_month, year=end_year)
))
params = None
for start, end in periods:
lookup = {'data_begin__range': (start, end)} if end else {'data_begin': start}
if params is None:
params = SQ(**lookup)
if self._date_begin_sqs_params is None:
periods = []
self.checked_monthes = {}
cleaned_periods = self.get_date_begin_periods()
# print(cleaned_periods)
date_range = self.get_date_from_to_range()
if date_range is not None:
periods.append(date_range)
else:
params |= SQ(**lookup)
return params
for year, monthes in cleaned_periods.iteritems():
for month in monthes:
if month in self.checked_monthes.get(year, []):
continue
start_year, start_month = self.get_start_of_period(year, cleaned_periods, month)
end_year, end_month = self.get_end_of_period(year, cleaned_periods, month)
_first_day, _last_day = calendar.monthrange(end_year, end_month)
periods.append((
date.today().replace(day=1, month=start_month, year=start_year),
date.today().replace(day=_last_day, month=end_month, year=end_year)
))
if not monthes:
start_year, start_month = self.get_start_of_period(year, cleaned_periods)
end_year, end_month = self.get_end_of_period(year, cleaned_periods)
_first_day, _last_day = calendar.monthrange(end_year, end_month)
periods.append((
date.today().replace(day=1, month=start_month, year=start_year),
date.today().replace(day=_last_day, month=end_month, year=end_year)
))
params = None
for start, end in periods:
lookup = {'data_begin__range': (start, end)} if end else {'data_begin__gte': start}
if params is None:
params = SQ(**lookup)
else:
params |= SQ(**lookup)
self._date_begin_sqs_params = params
return self._date_begin_sqs_params
def make_rating_sqs_params(self):
params = None

@ -20,7 +20,7 @@ class ExpoMixin(object):
logo = self.files.filter(purpose='logo')
if logo:
return logo[0]
return logo
return self.logo
def get_preview(self):
@ -80,6 +80,11 @@ class EventMixin(object):
set_cached_translation(self.place, tr)
return self.place.name
def get_event_place_name(self):
if self.place:
return self.get_place_name
return getattr(self, 'place_alt', None)
def get_permanent_url(self):
url = '%s%s/'%(self.get_catalog_url(), self.url)
return url

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Loading…
Cancel
Save