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
d9ab150e
Commit
d9ab150e
authored
Jun 30, 2021
by
Matheus Miranda
Browse files
Automate certification for users
parent
889219b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
courses/certification/views.py
courses/certification/views.py
+10
-1
No files found.
courses/certification/views.py
View file @
d9ab150e
...
...
@@ -101,6 +101,15 @@ class CourseCertificationViewSet(viewsets.ModelViewSet):
if
not
self
.
request
.
GET
.
get
(
'user'
,
False
):
queryset
=
queryset
.
filter
(
course_student__user
=
self
.
request
.
user
)
cert
=
queryset
.
first
()
cs
=
cert
.
course_student
# Change receipt into certificate
if
cs
.
get_current_class
().
user_can_certificate
and
cs
.
course_finished
or
\
cs
.
get_current_class
().
user_can_certificate_even_without_progress
:
cert
.
type
=
'certificate'
cert
.
save
()
return
queryset
...
...
@@ -221,7 +230,7 @@ class CourseCertificationDetailView(DetailView):
certificate
.
course_student
.
finish_date
.
day
,
certificate
.
course_student
.
finish_date
.
month
,
certificate
.
course_student
.
finish_date
.
year
)
)
if
certificate
.
course_student
.
finish_date
else
'xx/xx/xxxx'
workspace
=
context
[
'cert_template'
].
workspace
w_name
=
workspace
.
name
if
workspace
else
''
...
...
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