Commit c34eba88 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'fix/avoid-duplicate-membership-emails' into 'master'

Do not send members duplicate emails about their membership

See merge request !555
parents 2bdd9fbd 23b21d15
......@@ -12,7 +12,8 @@ from thaliawebsite.settings import settings
def send_membership_announcement(dry_run=False):
members = (models.Member.active_members
.filter(user__membership__until__isnull=True))
.filter(user__membership__until__isnull=True)
.distinct())
with mail.get_connection() as connection:
for member in members:
......@@ -77,7 +78,8 @@ def send_information_request(dry_run=False):
def send_expiration_announcement(dry_run=False):
expiry_date = datetime.now() + timedelta(days=31)
members = (models.Member.active_members
.filter(user__membership__until__lte=expiry_date))
.filter(user__membership__until__lte=expiry_date)
.distinct())
with mail.get_connection() as connection:
for member in members:
......
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