Skip to content

Commit

Permalink
Merge pull request #947 from amakarudze/update-emails
Browse files Browse the repository at this point in the history
Update email templates for global partners
  • Loading branch information
amakarudze authored Feb 27, 2024
2 parents bd65e79 + b556dab commit 873b337
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 16 deletions.
1 change: 1 addition & 0 deletions core/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def notify_new_user(user, event, password, errors=None):
"user": user,
"event": event,
"password": password,
"slack_invite_link": settings.SLACK_INVITE_LINK,
"errors": errors,
},
)
Expand Down
1 change: 1 addition & 0 deletions djangogirls/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def gettext(s):
SLACK_BOT_TOKEN = os.environ.get("SLACK_BOT_TOKEN")
SLACK_TEAM_ID = os.environ.get("SLACK_TEAM_ID")
SLACK_INVITE_CHANNEL_IDS = os.environ.get("SLACK_INVITE_CHANNEL_IDS", "").split(",")
SLACK_INVITE_LINK = os.environ.get("SLACK_INVITE_LINK", "")

RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY", "")
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY", "")
Expand Down
8 changes: 6 additions & 2 deletions globalpartners/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ def send_renewal_email(contact_person, contact_email):
"""Sends annual sponsors email asking if they are interested in supporting
our work in the new year.
"""
subject = "Will you be supporting us again in 2023?"
subject = f"Will you be supporting us again in {year}?"
template = "emails/globalpartners/renewal_email.html"
send_sponsor_email(contact_person, contact_email, template, subject)


def send_promotional_material_email(
contact_person, contact_email, prospective_sponsor, sponsor_level_annual, errors=None
contact_person,
contact_email,
prospective_sponsor,
sponsor_level_annual,
errors=None,
):
"""Sends new sponsors/patreon sponsors asking them for materials to use in
announcing/promoting the sponsor."""
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from datetime import date

from django.core.management.base import BaseCommand

from globalpartners.emails import send_prospective_sponsor_email
from globalpartners.models import GlobalPartner


class Command(BaseCommand):
help = "Sends emails to prospective sponsors"

def add_arguments(self, parser):
pass

def handle(self, *args, **kwargs):
try:
prospective_sponsors = GlobalPartner.objects.exclude(prospective_sponsor=False).filter(contacted=False)
for sponsor in prospective_sponsors:
send_prospective_sponsor_email(sponsor.contact_person, sponsor.contact_email)
sponsor.contacted = True
sponsor.date_contacted = date.today()
sponsor.save(update_fields=["contacted", "date_contacted"])
except GlobalPartner.DoesNotExist:
self.stdout.write(self.style.error("No prospective sponsors to email at this point."))
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.core.management.base import BaseCommand

from globalpartners.emails import send_promotional_material_email
from globalpartners.models import GlobalPartner


class Command(BaseCommand):
help = "Sends emails to sponsors asking them for promotional materials"

def add_arguments(self, parser):
pass

def handle(self, *args, **kwargs):
try:
sponsors = (
GlobalPartner.objects.exclude(prospective_sponsor=True)
.filter(promotional_materials_requested=False)
.filter(is_active=True)
)
for sponsor in sponsors:
send_promotional_material_email(
sponsor.contact_person,
sponsor.contact_email,
sponsor.prospective_sponsor,
sponsor.sponsor_level_annual,
)
sponsor.promotional_materials_requested = True
sponsor.save(update_fields=["promotional_materials_requested"])
except GlobalPartner.DoesNotExist:
self.stdout.write(self.style.error("No emails requesting promotional materials to send at this point."))
29 changes: 29 additions & 0 deletions globalpartners/management/commands/send_sponsor_renewal_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from datetime import date

from django.core.management.base import BaseCommand

from globalpartners.emails import send_renewal_email
from globalpartners.models import GlobalPartner


class Command(BaseCommand):
help = "Sends renewal emails to sponsors"

def add_arguments(self, parser):
pass

def handle(self, *args, **kwargs):
try:
sponsors = (
GlobalPartner.objects.exclude(prospective_sponsor=True)
.filter(patreon_sponsor=False)
.filter(contacted=False)
.filter(next_renewal_date__lte=date.today())
)
for sponsor in sponsors:
send_renewal_email(sponsor.contact_email, sponsor.contact_email)
sponsor.contacted = True
sponsor.date_contacted = date.today()
sponsor.save(update_fields=["contacted", "date_contacted"])
except GlobalPartner.DoesNotExist:
self.stdout.write(self.style.error("No sponsor renewal emails to email at this point."))
26 changes: 26 additions & 0 deletions globalpartners/management/commands/send_sponsor_thank_you_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from datetime import date

from django.core.management.base import BaseCommand

from globalpartners.emails import send_thank_you_email
from globalpartners.models import GlobalPartner


class Command(BaseCommand):
help = "Sends thank you emails to sponsors at the end of the year"

def add_arguments(self, parser):
pass

def handle(self, *args, **kwargs):
today = date.today()
year = today.year
if today == date(year, 12, 12):
try:
sponsors = GlobalPartner.objects.exclude(is_active=False).filter(is_displayed=True)
for sponsor in sponsors:
send_thank_you_email(sponsor.contact_person, sponsor.contact_email)
sponsor.contacted = False
sponsor.save(update_fields=["contacted"])
except GlobalPartner.DoesNotExist:
self.stdout.write(self.style.error("No thank you emails to send at this point."))
23 changes: 23 additions & 0 deletions globalpartners/migrations/0004_auto_20240226_2119.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.20 on 2024-02-26 21:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("globalpartners", "0003_globalpartner_description"),
]

operations = [
migrations.AddField(
model_name="globalpartner",
name="is_active",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="globalpartner",
name="promotional_materials_requested",
field=models.BooleanField(default=False),
),
]
7 changes: 6 additions & 1 deletion globalpartners/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ class GlobalPartner(models.Model):
contacted = models.BooleanField(default=False)
date_contacted = models.DateField(blank=True, null=True)
next_renewal_date = models.DateField(blank=True, null=True)
promotional_materials_requested = models.BooleanField(default=False)
logo = models.ImageField(upload_to="uploads", blank=True, null=True)
description = models.TextField(max_length=1000, blank=True, null=True)
is_active = models.BooleanField(default=False)
is_displayed = models.BooleanField(default=False)
website_url = models.URLField(blank=True, null=True)
style = models.CharField(max_length=50, blank=True, null=True)
Expand All @@ -60,7 +62,10 @@ def send_renewal_email(self):

def send_promotional_material_email(self):
send_promotional_material_email(
self.contact_person, self.contact_email, self.prospective_sponsor, self.sponsor_level_annual
self.contact_person,
self.contact_email,
self.prospective_sponsor,
self.sponsor_level_annual,
)
self.update_details()

Expand Down
2 changes: 1 addition & 1 deletion templates/emails/globalpartners/prospective_sponsor.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<p>We are currently looking for new corporate sponsors who will sponsor us through either monthly donations
or with a once off annual donation. I would like to check with you if your company would consider sponsoring Django Girls.</p>

<p>Please see attached our sponsors deck for 2023 https://drive.google.com/file/d/1T2jL9tnu5ZkNvkQRAxd7jlt_BnX7VCLE/view
<p>Please see attached our sponsors deck for {% now "Y" %} https://drive.google.com/file/d/1fAmyAiEyLGiE0s6_z3PzgLByHNKzEVHB/view
for our sponsor packages. </p>

<p>If your organisation is interested, kindly get back to me and we can discuss next steps or set up a meeting
Expand Down
27 changes: 16 additions & 11 deletions templates/emails/globalpartners/renewal_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@
<p>We would like to thank you for your past support, we are so grateful that you chose
to help Django Girls on our mission to inspire women to fall in love with programming.</p>

<p>In 2021, we introduced an advisory board that has been helping us with diversity and inclussion matters,
worked with diversity consultants to update our resources to be more inclusive and we continued with
that mission in 2022. In 2022, we resumed support for in-person workshops. However, we have noticed that
the number of workshops being organized has greatly reduced following the pandemic and we hope to address
this by increasing visibility for our work.</p>
<p> Since resuming the in-person workshops in 2022, we noticed that the number of workshops being organized was
greatly reduced following the pandemic and we hoped to address this in 2023 by increasing visibility for our work.
Our plan was to introduce a new role of Communications Officer to help us with our branding and visibility.
</p>

<p>We need your support to enable us to continue our work so we thought we should check to see
if you, our amazing sponsors are willing to renew your sponsorship with us in our 2023 fundraising
<p> We are so excited to inform you our global partner that we managed to achieve our focus and mission for 2023
to increase our visibility by introducing a part-time paid Communications Officer role to help promote our work.
We also promoted our former Awesomeness Ambassador, Claire Wicher to the new role of Chief Emoji Officer
(Managing Director) and hired a new Awesomeness Ambassador, growing the number of our paid staff to four.
</p>

<p> We need your support to enable us to continue our work so we thought we should check to see
if you, our amazing sponsors are willing to renew your sponsorship with us in our {% now "Y" %} fundraising
period. Should you be interested in supporting us, please find attached our sponsors’ deck
here https://drive.google.com/file/d/1T2jL9tnu5ZkNvkQRAxd7jlt_BnX7VCLE/view for the 2023
fundraising period. Our focus and mission for the upcoming year is in increasing visibility
by introducing a part-time paid Communications Officer role to help promote our work.</p>
here https://drive.google.com/file/d/1fAmyAiEyLGiE0s6_z3PzgLByHNKzEVHB/view for the {% now "Y" %}
fundraising period.
</p>

<p>Thank you once again for supporting our work. We look forward to working with you again in 2023.</p>
<p>Thank you once again for supporting our work. We look forward to working with you again in {% now "Y" %}.</p>
<br>
<p>Sparkles, cupcakes and high-fives, 🎉🎊🎉✨🍰👋</p>

Expand Down
7 changes: 6 additions & 1 deletion templates/emails/new_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
{% endblocktrans %}
</p>

<p>{% trans "We also invited you to Django Girls Slack, where we chat, communicate and meet each other!" %}</p>
<p>
{% blocktrans trimmed %}
Click <a href="{{ slack_invite_link }}">this link</a> to join <a href="{{ slack_invite_link }}">Django Girls Slack</a>,
where we chat, communicate and meet each other!
{% endblocktrans %}
</p>

<p>
{% blocktrans trimmed %}
Expand Down
114 changes: 114 additions & 0 deletions tests/globalpartners/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
from io import StringIO

import pytest

from globalpartners.models import GlobalPartner


@pytest.fixture
def out():
out = StringIO()
return out


@pytest.fixture
def global_partner_data():
Expand All @@ -17,3 +27,107 @@ def global_partner_data():
"website_url": "https://www.djangoproject.com",
}
return data


@pytest.fixture
def partners():
return GlobalPartner.objects.bulk_create(
[
GlobalPartner(
company_name="Sherpany",
contact_person="Jane Doe",
contact_email="[email protected]",
prospective_sponsor=True,
contacted=False,
),
GlobalPartner(
company_name="DigitalOcean",
contact_person="John Doe",
contact_email="[email protected]",
prospective_sponsor=True,
contacted=True,
),
GlobalPartner(
company_name="PythonAnywhere",
contact_person="Jane Doe",
contact_email="[email protected]",
prospective_sponsor=False,
patreon_sponsor=True,
patreon_level_per_month=500,
sponsor_level_annual=5000,
contacted=False,
promotional_materials_requested=False,
is_active=True,
),
GlobalPartner(
company_name="3YourMind",
contact_person="John Doe",
contact_email="[email protected]",
prospective_sponsor=False,
patreon_sponsor=True,
patreon_level_per_month=500,
sponsor_level_annual=5000,
contacted=True,
promotional_materials_requested=True,
is_active=True,
),
GlobalPartner(
company_name="Zapier",
contact_person="John Doe",
contact_email="[email protected]",
prospective_sponsor=False,
patreon_sponsor=True,
patreon_level_per_month=500,
sponsor_level_annual=5000,
contacted=True,
promotional_materials_requested=False,
is_active=True,
),
GlobalPartner(
company_name="PostHog",
contact_person="Jane Tes",
contact_email="[email protected]",
prospective_sponsor=False,
patreon_sponsor=False,
sponsor_level_annual=1000,
contacted=False,
promotional_materials_requested=False,
is_active=False,
next_renewal_date="2024-02-15",
),
GlobalPartner(
company_name="Torchbox",
contact_person="John Test",
contact_email="[email protected]",
prospective_sponsor=False,
patreon_sponsor=False,
sponsor_level_annual=500,
contacted=True,
promotional_materials_requested=False,
is_active=True,
next_renewal_date="2024-02-15",
),
GlobalPartner(
company_name="Mirumee",
contact_person="Test Contact",
contact_email="[email protected]",
prospective_sponsor=False,
sponsor_level_annual=2500,
contacted=True,
promotional_materials_requested=True,
is_active=True,
next_renewal_date="2024-02-15",
),
GlobalPartner(
company_name="Mirumee",
contact_person="Test Contact",
contact_email="[email protected]",
prospective_sponsor=False,
sponsor_level_annual=2500,
contacted=True,
promotional_materials_requested=False,
is_active=False,
next_renewal_date="2024-02-15",
),
]
)
Loading

0 comments on commit 873b337

Please sign in to comment.