Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
16c73b27
Commit
16c73b27
authored
Jun 02, 2021
by
Matheus Miranda
Browse files
Update condition for email sending
parent
8cf8755a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
courses/models.py
courses/models.py
+6
-3
No files found.
courses/models.py
View file @
16c73b27
...
...
@@ -805,15 +805,18 @@ class ProfessorMessage(models.Model):
subject_en
=
Template
(
et
.
subject
).
render
(
Context
({
'subject'
:
self
.
subject_en
}))
message_en
=
Template
(
et
.
template
).
render
(
Context
({
'message'
:
self
.
message_en
}))
self
.
send_emails
(
bcc_en
,
message_en
,
subject_en
,
email_batch_size
)
if
subject_en
and
message_en
:
self
.
send_emails
(
bcc_en
,
message_en
,
subject_en
,
email_batch_size
)
subject_es
=
Template
(
et
.
subject
).
render
(
Context
({
'subject'
:
self
.
subject_es
}))
message_es
=
Template
(
et
.
template
).
render
(
Context
({
'message'
:
self
.
message_es
}))
self
.
send_emails
(
bcc_es
,
message_es
,
subject_es
,
email_batch_size
)
if
subject_es
and
message_es
:
self
.
send_emails
(
bcc_es
,
message_es
,
subject_es
,
email_batch_size
)
subject_pt_br
=
Template
(
et
.
subject
).
render
(
Context
({
'subject'
:
self
.
subject_pt_br
}))
message_pt_br
=
Template
(
et
.
template
).
render
(
Context
({
'message'
:
self
.
message_pt_br
}))
self
.
send_emails
(
bcc_pt_br
,
message_pt_br
,
subject_pt_br
,
email_batch_size
)
if
subject_pt_br
and
message_pt_br
:
self
.
send_emails
(
bcc_pt_br
,
message_pt_br
,
subject_pt_br
,
email_batch_size
)
else
:
bcc
=
[
u
.
email
for
u
in
self
.
users
.
all
()
if
u
.
is_active
and
re
.
match
(
r
"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
,
u
.
email
)]
subject
=
Template
(
et
.
subject
).
render
(
Context
({
'subject'
:
self
.
subject
}))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment