From 9be11dd9e4cdb2f9a1d534f9446c86a11ff6d2a3 Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Thu, 9 Feb 2017 12:04:30 +0200 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D1=83=D1=8E=20=D0=B2?= =?UTF-8?q?=20=D1=82=D0=B5=D0=BB=D0=BE=20=D0=BF=D0=B8=D1=81=D1=8C=D0=BC?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/emencia/django/newsletter/mailer.py | 10 ++++++--- proj/settings.py | 22 ------------------- .../newsletters/newsletter_object.html | 2 ++ 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/apps/emencia/django/newsletter/mailer.py b/apps/emencia/django/newsletter/mailer.py index 2f6fa504..8a60e84c 100644 --- a/apps/emencia/django/newsletter/mailer.py +++ b/apps/emencia/django/newsletter/mailer.py @@ -167,7 +167,12 @@ class NewsLetterSender(object): all the attached files. """ - content_html = self.build_email_content(contact, announce_context, name) + content_html = self.build_email_content(contact, announce_context) + content_html = content_html.format( + **{ + 'name': name or contact.first_name or contact.last_name or _(u'Подписчик') + } + ) h = HTMLParser.HTMLParser() content_html = h.unescape(content_html) @@ -392,7 +397,7 @@ class NewsLetterSender(object): title = self.newsletter.title2.format(**self.preheader_ctx) return title - def build_email_content(self, contact, announce_context=None, name=None): + def build_email_content(self, contact, announce_context=None): """Generate the mail for a contact""" uidb36, token = tokenize(contact) context = Context({'contact': contact, @@ -400,7 +405,6 @@ class NewsLetterSender(object): 'newsletter': self.newsletter, 'tracking_image_format': TRACKING_IMAGE_FORMAT, 'uidb36': uidb36, 'token': token, - 'name': name or contact.first_name or contact.last_name or _(u'Подписчик'), 'settings_links': self.settings_links, }) if self.announce: diff --git a/proj/settings.py b/proj/settings.py index 9d6b0e39..db4237ae 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -435,28 +435,6 @@ HAYSTACK_CONNECTIONS = { }, } -# TODO automate crons -""" -# update search indexes -0 * * * * /usr/bin/python /var/www/proj/manage.py update_index conference --remove --age=6 -0 * * * * /usr/bin/python /var/www/proj/manage.py update_index exposition --remove --age=6 -0 1,13 * * * /usr/bin/python /var/www/proj/manage.py update_index place_exposition --remove --age=24 -0 3 * * * /usr/bin/python /var/www/proj/manage.py update_index company --remove --age=48 -0 4 * * * /usr/bin/python /var/www/proj/manage.py update_index theme --remove --age=48 -0 5 * * * /usr/bin/python /var/www/proj/manage.py update_index tag --remove --age=48 -0 6 * * * /usr/bin/python /var/www/proj/manage.py update_index country --remove --age=48 -0 7 * * * /usr/bin/python /var/www/proj/manage.py update_index city --remove --age=48 -# update banner logs -10 * * * * /usr/bin/python /var/www/proj/manage.py banner_log_update -20 2,14 * * * /usr/bin/python /var/www/proj/manage.py banner_log_check_previous_day -# update hotels prices -20 1 * * 6 /usr/bin/python /var/www/proj/manage.py update_hotels_price -# newsletter -20 * * * * /usr/bin/python /var/www/proj/manage.py send_newsletter -40 6 * * * /usr/bin/python /var/www/proj/manage.py newsletter_contacts_remove_notactivated - -""" - THUMBNAIL_ENGINE = "proj.sorlengine.SorlEngine" THUMBNAIL_FORMAT = "PNG" diff --git a/templates/c_admin/newsletters/newsletter_object.html b/templates/c_admin/newsletters/newsletter_object.html index e365bf1e..1f75a93f 100644 --- a/templates/c_admin/newsletters/newsletter_object.html +++ b/templates/c_admin/newsletters/newsletter_object.html @@ -65,6 +65,8 @@ {% trans "Доступные параметры для прехедера" %}:

{% trans "{name} - имя пользователя" %}

{% trans "{themes} - темы на которые пользователь подписан (первые 3 + кол-во оставшихся)" %}

+ {% trans "Доступные параметры для контента" %}: +

{% trans "{name} - имя пользователя" %}