Commit a1b3ae67 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Merge branch 'feature/103-3-non-expiring-notifications' into 'master'

Administratietrucjes: Email non expiring notifications

See merge request !506
parents a9e1f1bf 461a8117
from django.core import mail
from django.template import loader
from django.utils import translation
from django.utils.translation import ugettext as _
from members import models
from thaliawebsite.settings import settings
def send_membership_announcement(dry_run=False):
members = (models.Member.active_members
.filter(user__membership__until__isnull=True))
with mail.get_connection() as connection:
for member in members:
print("Send email to {} ({})".format(member.get_full_name(),
member.user.email))
if not dry_run:
with translation.override(member.language):
email_body = loader.render_to_string(
'members/email/membership_announcement.txt',
{'name': member.get_full_name()})
mail.EmailMessage(
_('Membership announcement'),
email_body,
settings.WEBSITE_FROM_ADDRESS,
[member.user.email],
bcc=[settings.BOARD_NOTIFICATION_ADDRESS],
connection=connection
).send()
if not dry_run:
mail.mail_managers(
_('Membership announcement sent'),
loader.render_to_string(
'members/email/membership_announcement_notification.txt',
{'members': members}),
connection=connection,
)
......@@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-26 18:58+0200\n"
"PO-Revision-Date: 2017-04-12 19:40+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"POT-Creation-Date: 2017-06-14 21:21+0200\n"
"PO-Revision-Date: 2017-06-14 21:22+0200\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.12\n"
"X-Generator: Poedit 2.0.2\n"
#: admin.py:36
msgid "membership type"
......@@ -74,6 +74,14 @@ msgstr "Studentnummer"
msgid "Download student number label for selected users"
msgstr "Download studentnummers voor geselecteerde gebruikers"
#: emails.py:24
msgid "Membership announcement"
msgstr "Mededeling over lidmaatschap"
#: emails.py:34
msgid "Membership announcement sent"
msgstr "Mededeling over lidmaatschap verzonden"
#: forms.py:42
msgid "Send welcome email"
msgstr "Stuur welkomste-mails"
......@@ -426,6 +434,50 @@ msgstr ""
msgid "save"
msgstr "opslaan"
#: templates/members/email/membership_announcement.txt:1
#, python-format
msgid ""
"Dear %(name)s,\n"
"\n"
"You're a study member of Thalia. This means that you'll be a member as long\n"
"as you're enrolled in either a computer science or an information science "
"programme.\n"
"\n"
"Are you still studying? Then you don't have to do anything at all!\n"
"Did you graduate or stop with your studies for any other reason? Then "
"please\n"
"send us an email so that we can update our administration: info@thalia.nu\n"
"\n"
"If you have any questions, then don't hesitate and send us an email.\n"
"\n"
"With kind regards,\n"
"\n"
"The board of Study Association Thalia\n"
"\n"
"————\n"
"\n"
"This email was automatically generated."
msgstr ""
"Dear %(name)s,\n"
"\n"
"Je bent studielid van Thalia. Dit betekent dat zolang je informatica of\n"
"informatiekunde studeert je lid bent van Thalia. Studeer je nog? Dan hoef "
"je\n"
"niets te doen! Ben je afgestudeerd of om een andere reden gestopt met je "
"studie?\n"
"Stuur dan even een mailtje naar info@thalia.nu, zodat we je uit het systeem\n"
"kunnen halen.\n"
"\n"
"Als je vragen hebt over dit mailje kun je uiteraard ook contact opnemen.\n"
"\n"
"Met vriendelijke groeten,\n"
"\n"
"Het bestuur der Studievereniging Thalia\n"
"\n"
"————\n"
"\n"
"Deze e-mail is automatisch gegenereerd."
#: templates/members/email/welcome.txt:1
#, python-format
msgid ""
......@@ -523,6 +575,6 @@ msgstr "Statistieken"
msgid "Total amount of Thalia members"
msgstr "Totaal aantal Thalialeden"
#: views.py:143
#: views.py:105
msgid "Former member"
msgstr "Oud-lid"
from django.core.management.base import BaseCommand
from members import emails
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--dry-run',
action='store_true',
dest='dry-run',
default=False,
help='Dry run instead of sending e-mail',
)
def handle(self, *args, **options):
emails.send_membership_announcement(
bool(options['dry-run']))
{% load i18n %}{% blocktrans %}Dear {{ name }},
You're a study member of Thalia. This means that you'll be a member as long
as you're enrolled in either a computer science or an information science programme.
Are you still studying? Then you don't have to do anything at all!
Did you graduate or stop with your studies for any other reason? Then please
send us an email so that we can update our administration: info@thalia.nu
If you have any questions, then don't hesitate and send us an email.
With kind regards,
The board of Study Association Thalia
————
This email was automatically generated.{% endblocktrans %}
Dear board,
It's that time of the year again! The website sent an automatic email to
all members that have a study membership.
That email tells them that their membership is valid as long as they're enrolled
in either a computer science or an information science programme.
We asked them to notify you when they graduate or stop with their studies for any
other reason so that you'll be able to update the administration.
This means that you can expect an influx of emails from members.
The email was sent to:
{% for member in members %}
* {{ member.full_name }}
{% endfor %}
Kisses,
The website
......@@ -232,6 +232,12 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Newsletter settings
NEWSLETTER_FROM_ADDRESS = 'nieuwsbrief@thalia.nu'
# Website FROM address
WEBSITE_FROM_ADDRESS = 'info@thalia.nu'
# Board notification address
BOARD_NOTIFICATION_ADDRESS = 'info@thalia.nu'
# Photos settings
PHOTO_UPLOAD_SIZE = 1920, 1080
......
Supports Markdown
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