I’m trying to filter out multiple emails from a queryset in order to stop our employee emails from affecting any exports. I have the following in settings.py:
EMAIL_FILTERS = ['email1', 'email2']
and I’m trying to use this to filter out any entries in the DB with our emails in the following query:
EMAIL_FILTERS = getattr(settings, 'EMAIL_FILTERS')
campaigns = CampaignsSignup.objects.filter(created_date__gte=self._get_start_date(dte),
created_date__lte=self._get_end_date(dte)).order_by('-created_date')
However after trying Q and exclude I can’t seem to get it to work. I should also note as much as I would like to be able to use endswith some of the employees are using their personal email address so at the moment it wouldn’t be viable.
Thanks.
I see you’ve found a solution, but the normal way to do this is with
exclude: