Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c801fadc
Commit
c801fadc
authored
Jun 11, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added email sending when pre-generated certificate is requested.
parent
35faddca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
djangoapps/certificates/views.py
+9
-2
templates/emails/certificate_ready.txt
+4
-0
templates/emails/certificate_ready_subject.txt
+2
-0
No files found.
djangoapps/certificates/views.py
View file @
c801fadc
...
...
@@ -5,12 +5,13 @@ import uuid
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.core.mail
import
send_mail
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
redirect
import
courseware.grades
as
grades
from
certificates.models
import
GeneratedCertificate
,
certificate_state_for_student
from
mitxmako.shortcuts
import
render_to_response
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
student.models
import
UserProfile
from
student.survey_questions
import
exit_survey_list_for_student
from
student.views
import
student_took_survey
,
record_exit_survey
...
...
@@ -110,7 +111,7 @@ def generate_certificate(user, grade):
if
generated_certificate
.
download_url
and
(
generated_certificate
.
name
!=
user_name
):
log
.
critical
(
"A Certificate has been pre-generated with the name of "
+
str
(
generated_certificate
.
name
)
+
" but current name is "
+
str
(
user_name
)
+
\
"! The download URL is "
+
str
(
generated_certificate
.
download_url
))
generated_certificate
.
grade
=
grade
generated_certificate
.
name
=
user_name
...
...
@@ -121,6 +122,12 @@ def generate_certificate(user, grade):
log
.
debug
(
"Generating certificate for "
+
str
(
user
.
username
)
+
" with ID: "
+
certificate_id
)
# TODO: If the certificate was pre-generated, send the email that it is ready to download
if
certificate_state_for_student
(
user
,
grade
)[
'state'
]
==
"downloadable"
:
subject
=
render_to_string
(
'emails/certificate_ready_subject.txt'
,{})
subject
=
''
.
join
(
subject
.
splitlines
())
message
=
render_to_string
(
'emails/certificate_ready.txt'
,{})
res
=
send_mail
(
subject
,
message
,
settings
.
DEFAULT_FROM_EMAIL
,
[
user
.
email
,])
else
:
log
.
warning
(
"Asked to generate a certifite for student "
+
str
(
user
.
username
)
+
" but without a grade."
)
templates/emails/certificate_ready.txt
0 → 100644
View file @
c801fadc
Congratulations on completing 6.002x! We have received your request
for a certifcate, and it is ready to download. Please visit your
<a href="http://6002x.mitx.mit.edu/Profile">Profile</a> to download your certificate.
\ No newline at end of file
templates/emails/certificate_ready_subject.txt
0 → 100644
View file @
c801fadc
6.002x Certificate Ready to Download
\ No newline at end of file
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