Commit 7aa87bb5 authored by Adrián Ribao's avatar Adrián Ribao
Browse files

don't send to excluded emails

parent 9317f457
Pipeline #243 passed with stage
in 44 seconds
......@@ -15,7 +15,7 @@ from django.core.signing import Signer
from django.core.urlresolvers import reverse
from django.template import Template, Context
from cartero.models import ShortURL, MailTracks
from cartero.models import ShortURL, MailTracks, ExcludedEmail
class CampaignDeliver(object):
......@@ -135,7 +135,10 @@ class CampaignDeliver(object):
return msg
def get_contacts(self, testing=False):
contacts = self.contact_list.contacts.all()
excluded_emails = ExcludedEmail.objects.all() \
.values_list('email', flat=True)
contacts = self.contact_list.contacts.exclude(email__in=excluded_emails)
if testing:
contacts = contacts.filter(testing=True)
return contacts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment