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

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. 7
      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 *
DEBUG = True
# emencia.django.newsletter
LOCAL_DEV = True
# sorl.thumbnail
THUMBNAIL_DEBUG = True
DEFAULT_HTTP_SCHEME = 'http'

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

@ -1,11 +1,14 @@
"""Command for sending the newsletter"""
from datetime import date, timedelta
from datetime import date
from django.core.management.base import NoArgsCommand
from emencia.django.newsletter.models import MailingList
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.'
def handle(self, *args, **options):

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

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

@ -673,7 +673,7 @@
</tr>
{% endif %}
<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>
</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>
</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>
</table>

@ -36,8 +36,8 @@ def track_links(content, context):
link_href = link_markup['href']
link_title = link_markup.get('title', link_href)
try:
link, created = Link.objects.get_or_create(url=link_href,
defaults={'title': link_title})
link, created = Link.objects.get_or_create(url=link_href[:250],
defaults={'title': link_title[:250]})
except Link.MultipleObjectsReturned:
link = Link.objects.filter(url=link_href)[0]
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')
filter_form = ContactFilterForm
def get(self, request, *args, **kwargs):
form = self.filter_form(request.GET)
if form.is_valid():

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

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

Loading…
Cancel
Save