Skip to content
Snippets Groups Projects

Release

Merged Alexa Valentová requested to merge test into master
1 file
+ 27
5
Compare changes
  • Side-by-side
  • Inline
+ 27
5
@@ -620,7 +620,26 @@ class MainCareerPage(
@@ -620,7 +620,26 @@ class MainCareerPage(
for file in form.cleaned_data["other_files"]:
for file in form.cleaned_data["other_files"]:
other_files_names += f" - {file.name}\n"
other_files_names += f" - {file.name}\n"
email = EmailMessage(
recipient_email = EmailMessage(
 
# Subject
 
f"Potvrzení přihlášky k pracovní pozici {self.title}",
 
# Message
 
f"""
 
Dobrý den,
 
 
potvrzujeme přijetí Vaší přihlášky k pracovní pozici '{self.title}'.
 
Budeme vás co nejdříve kontaktovat s dalšími informacemi.
 
 
Děkujeme,
 
Pirátská Strana
 
""",
 
# From email
 
"vyberka@pirati.cz",
 
# To email
 
[form.cleaned_data['email']],
 
)
 
 
administrator_email = EmailMessage(
# Subject
# Subject
f"Nová přihláška k pracovní pozici {self.title} - {form.cleaned_data['name']} {form.cleaned_data['surname']}",
f"Nová přihláška k pracovní pozici {self.title} - {form.cleaned_data['name']} {form.cleaned_data['surname']}",
# Message
# Message
@@ -654,14 +673,14 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
@@ -654,14 +673,14 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
)
)
form.cleaned_data["cv_file"].seek(0)
form.cleaned_data["cv_file"].seek(0)
email.attach(
administrator_email.attach(
form.cleaned_data["cv_file"].name,
form.cleaned_data["cv_file"].name,
form.cleaned_data["cv_file"].read(),
form.cleaned_data["cv_file"].read(),
form.cleaned_data["cv_file"].content_type,
form.cleaned_data["cv_file"].content_type,
)
)
form.cleaned_data["cover_letter_file"].seek(0)
form.cleaned_data["cover_letter_file"].seek(0)
email.attach(
administrator_email.attach(
form.cleaned_data["cover_letter_file"].name,
form.cleaned_data["cover_letter_file"].name,
form.cleaned_data["cover_letter_file"].read(),
form.cleaned_data["cover_letter_file"].read(),
form.cleaned_data["cover_letter_file"].content_type,
form.cleaned_data["cover_letter_file"].content_type,
@@ -669,9 +688,12 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
@@ -669,9 +688,12 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
for file in form.cleaned_data["other_files"]:
for file in form.cleaned_data["other_files"]:
file.seek(0)
file.seek(0)
email.attach(file.name, file.read(), file.content_type)
administrator_email.attach(file.name, file.read(), file.content_type)
sent_successfully = email.send()
sent_successfully = (
 
administrator_email.send()
 
and recipient_email.send()
 
)
if sent_successfully:
if sent_successfully:
messages.add_message(
messages.add_message(
Loading