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
dd80e024
Commit
dd80e024
authored
4 years ago
by
Virgilio Santos
Browse files
Options
Download
Email Patches
Plain Diff
certificate: fix CourseCertification creation signal
parent
70976c3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
courses/certification/signals.py
courses/certification/signals.py
+4
-5
No files found.
courses/certification/signals.py
View file @
dd80e024
...
...
@@ -10,14 +10,13 @@ from courses.certification.models import CourseCertification, CertificateTemplat
@
receiver
(
post_save
,
sender
=
CourseStudent
)
def
course_student_created_or_updated
(
sender
,
created
,
instance
,
**
kwargs
):
def
course_student_created_or_updated
(
sender
,
created
,
instance
:
CourseStudent
,
**
kwargs
):
if
created
:
link_hash
=
ub64
(
sha1
(
str
(
time
())
+
instance
.
user
.
last_name
.
encode
(
'utf-8'
)).
digest
()[
0
:
6
])
link_hash
=
ub64
(
sha1
(
(
str
(
time
())
+
instance
.
user
.
last_name
)
.
encode
(
'utf-8'
)).
digest
()[
0
:
6
])
receipt
=
CourseCertification
(
course_student
=
instance
,
course
=
instance
.
course
,
type
=
CourseCertification
.
TYPES
[
0
][
0
],
is_valid
=
True
,
link_hash
=
link_hash
.
decode
())
type
=
CourseCertification
.
TYPES
[
0
][
0
],
is_valid
=
True
,
link_hash
=
link_hash
.
decode
())
receipt
.
save
()
...
...
This diff is collapsed.
Click to expand it.
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