-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add confirmation email functionality for bartender applications
- Loading branch information
1 parent
71e62e1
commit 19206df
Showing
10 changed files
with
219 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,43 @@ def send_email(self, pk): | |
to=["[email protected]"], | ||
) | ||
|
||
def send_confirmation_email(self, pk): | ||
d = self.cleaned_data | ||
|
||
extra_info = "" | ||
if d["info"]: | ||
extra_info = f""" | ||
Ekstra information: | ||
{d["info"]} | ||
""" | ||
d["extra_info"] = extra_info | ||
|
||
return send_template_email( | ||
subject=f"Kvittering for bartendertilmelding til fredagscaféen", | ||
body_template="""Dette er en automatisk email. | ||
Hej {name}, | ||
Tak for din ansøgning om at blive bartender i fredagscaféen! | ||
Vi gennemgår din ansøgning på næste bestyrelsesmøde, så forvent lidt ventetid, før du hører fra os. | ||
Kopi af din ansøgning: | ||
Navn: {name} | ||
Brugernavn: {username} | ||
Studienummer: {studentNumber} | ||
Email: {email} | ||
Telefonnummer: {phoneNumber} | ||
{extra_info} | ||
/snek""", | ||
text_format={**d}, | ||
html_format={ | ||
**d, | ||
}, | ||
to=[d["email"]], | ||
) | ||
|
||
|
||
class BartenderInfoForm(forms.ModelForm): | ||
class Meta: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Generated by Django 3.2.4 on 2024-12-12 22:45 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"bartenders", | ||
"0004_alter_bartender_email_alter_bartender_tshirt_size_and_more", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="bartendershift", | ||
options={"ordering": ("-start_datetime",)}, | ||
), | ||
migrations.AlterField( | ||
model_name="bartender", | ||
name="email", | ||
field=models.EmailField( | ||
help_text="En post.au mail fungerer ikke", | ||
max_length=254, | ||
unique=True, | ||
verbose_name="E-mail", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="bartender", | ||
name="studentNumber", | ||
field=models.IntegerField(null=True, verbose_name="Studienummer"), | ||
), | ||
migrations.AlterField( | ||
model_name="bartenderapplication", | ||
name="email", | ||
field=models.EmailField( | ||
help_text="En post.au mail fungerer ikke", | ||
max_length=254, | ||
unique=True, | ||
verbose_name="E-mail", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="bartenderapplication", | ||
name="info", | ||
field=models.TextField( | ||
help_text="Fortæl lidt om dig selv, og hvorfor du tror at lige præcist du, ville være en god bartender" | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="bartenderapplication", | ||
name="studentNumber", | ||
field=models.IntegerField(null=True, verbose_name="Studienummer"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ def send_template_email( | |
html_format={}, | ||
from_email="[email protected]", | ||
cc=[], | ||
reply_to=[], | ||
reply_to=["[email protected]"], | ||
): | ||
body_text = render_to_string( | ||
"email.txt", {"content": body_template.format(**text_format)} | ||
|
Binary file not shown.
Oops, something went wrong.