фикс багов в ежедневной рассылке

remotes/origin/tests
Slava Kyrachevsky 9 years ago
parent 71293580f6
commit 6cbe8e26d0
  1. 4
      README.md
  2. 2
      apps/emencia/django/newsletter/mailer.py
  3. 9
      apps/emencia/django/newsletter/management/commands/newsletter_create_announce.py
  4. 8
      apps/emencia/django/newsletter/management/commands/newsletter_create_dailymail.py
  5. 2
      apps/emencia/django/newsletter/management/commands/send_newsletter.py
  6. 2
      apps/emencia/django/newsletter/templates/newsletter/AutomaticEmail_v2.html
  7. 2
      apps/emencia/django/newsletter/templates/newsletter/AutomaticEmail_web.html
  8. 4
      apps/emencia/django/newsletter/utils/newsletter.py
  9. 1
      apps/emencia/django/newsletter/views/admin_views.py
  10. 6
      proj/settings.py
  11. 2
      requirements.txt

@ -7,6 +7,10 @@ Expomap project
from settings import * from settings import *
DEBUG = True DEBUG = True
# emencia.django.newsletter
LOCAL_DEV = True
# sorl.thumbnail
THUMBNAIL_DEBUG = True
DEFAULT_HTTP_SCHEME = 'http' DEFAULT_HTTP_SCHEME = 'http'

@ -409,7 +409,7 @@ class NewsLetterSender(object):
template = get_template('newsletter/AutomaticEmail_v2.html') template = get_template('newsletter/AutomaticEmail_v2.html')
context.update(announce_context) context.update(announce_context)
content = template.render(context) content = template.render(context)
elif self.newsletter.ab_testing == True: elif self.newsletter.ab_testing:
if self.ab_state == Newsletter.A: if self.ab_state == Newsletter.A:
content = self.newsletter_template.render(context) content = self.newsletter_template.render(context)
else: else:

@ -1,14 +1,17 @@
"""Command for sending the newsletter""" """Command for sending the newsletter"""
from datetime import date, timedelta from datetime import date
from django.core.management.base import NoArgsCommand from django.core.management.base import NoArgsCommand
from emencia.django.newsletter.models import MailingList from emencia.django.newsletter.models import MailingList
class Command(NoArgsCommand): class Command(NoArgsCommand):
"""this command run every day. check date and creates newsletter the day before announces need to send""" """
This command run every day.
Check date and creates newsletter the day before announces need to send
"""
help = 'create the announce every week.' help = 'create the announce every week.'
def handle(self, *args, **options): def handle(self, *args, **options):
announce_list = MailingList.objects.get(id=1) announce_list = MailingList.objects.get(id=1)
day = date.today() day = date.today()
announce_list.generate_announce_newsletter(day) announce_list.generate_announce_newsletter(day)

@ -5,8 +5,7 @@ from datetime import date, timedelta
from django.core.management.base import NoArgsCommand from django.core.management.base import NoArgsCommand
from django.utils.translation import activate from django.utils.translation import activate
from functions.form_check import translit_with_separator from emencia.django.newsletter.models import Newsletter
from emencia.django.newsletter.models import MailingList, Newsletter
class Command(NoArgsCommand): class Command(NoArgsCommand):
@ -26,8 +25,9 @@ class Command(NoArgsCommand):
'slug': 'dailymail-{date}'.format(date=day), 'slug': 'dailymail-{date}'.format(date=day),
'status': Newsletter.WAITING, 'status': Newsletter.WAITING,
} }
n, created = Newsletter.objects.get_or_create( Newsletter.objects.get_or_create(
dailymail=True, dailymail=True,
sending_date=day, sending_date=day,
defaults=defaults) defaults=defaults
)
day += timedelta(days=1) day += timedelta(days=1)

@ -33,7 +33,7 @@ class Command(NoArgsCommand):
for newsletter in Newsletter.objects.exclude( for newsletter in Newsletter.objects.exclude(
status__in=[Newsletter.DRAFT, status__in=[Newsletter.DRAFT,
Newsletter.SENT, Newsletter.SENT,
Newsletter.CANCELED,]): Newsletter.CANCELED]):
mailer = Mailer(newsletter, verbose=self.verbose) mailer = Mailer(newsletter, verbose=self.verbose)
if mailer.can_send: if mailer.can_send:
mailer.run() mailer.run()

@ -673,7 +673,7 @@
</tr> </tr>
{% endif %} {% endif %}
<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> <td align="center" style="padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 13px; color: #999999;">&copy; 2008 — 2017 Expomap.ru</td>
</tr> </tr>
</table> </table>

@ -671,7 +671,7 @@
<td align="center" style="font-family: Arial, sans-serif; font-size: 13px; color: #999999; padding-bottom: 7px;"><a href="{% url 'newsletter-sendtofriend' slug=newsletter.slug uidb36=uidb36 token=token %}" style="color: #ff6600;">{% trans "Переслать другу" %}</a> {% trans "или" %} <a href="#" style="color: #ff6600;">{% trans "Отписаться" %}</a></td> <td align="center" style="font-family: Arial, sans-serif; font-size: 13px; color: #999999; padding-bottom: 7px;"><a href="{% url 'newsletter-sendtofriend' slug=newsletter.slug uidb36=uidb36 token=token %}" style="color: #ff6600;">{% trans "Переслать другу" %}</a> {% trans "или" %} <a href="#" style="color: #ff6600;">{% trans "Отписаться" %}</a></td>
</tr> </tr>
<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> <td align="center" style="padding-bottom: 30px; font-family: Arial, sans-serif; font-size: 13px; color: #999999;">&copy; 2008 — 2017 Expomap.ru</td>
</tr> </tr>
</table> </table>

@ -36,8 +36,8 @@ def track_links(content, context):
link_href = link_markup['href'] link_href = link_markup['href']
link_title = link_markup.get('title', link_href) link_title = link_markup.get('title', link_href)
try: try:
link, created = Link.objects.get_or_create(url=link_href, link, created = Link.objects.get_or_create(url=link_href[:250],
defaults={'title': link_title}) defaults={'title': link_title[:250]})
except Link.MultipleObjectsReturned: except Link.MultipleObjectsReturned:
link = Link.objects.filter(url=link_href)[0] link = Link.objects.filter(url=link_href)[0]
link_markup['href'] = 'http://%s%s' % (context['domain'], reverse('newsletter_newsletter_tracking_link', link_markup['href'] = 'http://%s%s' % (context['domain'], reverse('newsletter_newsletter_tracking_link',

@ -137,7 +137,6 @@ class ContactQueryDelete(RedirectView):
url = reverse_lazy('newsletters_contact_list') url = reverse_lazy('newsletters_contact_list')
filter_form = ContactFilterForm filter_form = ContactFilterForm
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
form = self.filter_form(request.GET) form = self.filter_form(request.GET)
if form.is_valid(): if form.is_valid():

@ -402,8 +402,6 @@ INSTALLED_APPS = (
) )
CRONJOBS = [ CRONJOBS = [
('8 * * * *', 'django.core.management.call_command', ['send_newsletter']),
('0 * * * *', 'django.core.management.call_command', ['update_index', 'conference', '--remove', '--age=6']), ('0 * * * *', 'django.core.management.call_command', ['update_index', 'conference', '--remove', '--age=6']),
('5 * * * *', 'django.core.management.call_command', ['update_index', 'exposition', '--remove', '--age=6']), ('5 * * * *', 'django.core.management.call_command', ['update_index', 'exposition', '--remove', '--age=6']),
('0 1,13 * * *', 'django.core.management.call_command', ['update_index', 'place_exposition', '--remove', '--age=24']), ('0 1,13 * * *', 'django.core.management.call_command', ['update_index', 'place_exposition', '--remove', '--age=24']),
@ -418,8 +416,8 @@ CRONJOBS = [
('*/5 * * * *', 'django.core.management.call_command', ['update_views_cache']), ('*/5 * * * *', 'django.core.management.call_command', ['update_views_cache']),
('40 6 * * * ', 'django.core.management.call_command', ['newsletter_contacts_remove_notactivated']), ('40 6 * * * ', 'django.core.management.call_command', ['newsletter_contacts_remove_notactivated']),
# временно закомментировал по просьбе клиента ('30 2 * * *', 'django.core.management.call_command', ['newsletter_create_dailymail']),
# ('41 5 * * *', 'django.core.management.call_command', ['newsletter_create_announce']), ('35 * * * *', 'django.core.management.call_command', ['send_newsletter']),
('12 4 * * *', 'django.core.management.call_command', ['stats_daily']), ('12 4 * * *', 'django.core.management.call_command', ['stats_daily']),
('5 10 * * *', 'django.core.management.call_command', ['update_events_filter_fields']), ('5 10 * * *', 'django.core.management.call_command', ['update_events_filter_fields']),

@ -36,7 +36,7 @@ numpy==1.12.0
oauthlib==0.6.1 oauthlib==0.6.1
pandas==0.19.2 pandas==0.19.2
phonenumbers==6.0.0 phonenumbers==6.0.0
Pillow==2.5.3 Pillow==3.4.2
polib==1.0.8 polib==1.0.8
pylibmc==1.2.3 pylibmc==1.2.3
pymorphy==0.5.6 pymorphy==0.5.6

Loading…
Cancel
Save