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
ede1052b
Commit
ede1052b
authored
May 21, 2021
by
Matheus Miranda
Browse files
Update CertificateTemplate view
parent
d1b1976a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
courses/certification/views.py
courses/certification/views.py
+6
-4
No files found.
courses/certification/views.py
View file @
ede1052b
...
...
@@ -106,8 +106,8 @@ class CourseCertificationViewSet(viewsets.ModelViewSet):
class
CertificateTemplateViewSet
(
viewsets
.
ModelViewSet
):
model
=
CertificateTemplate
queryset
=
CertificateTemplate
.
objects
.
filter
(
document_type
=
'certificate'
)
lookup_field
=
'course'
queryset
=
CertificateTemplate
.
objects
.
all
(
)
#
lookup_field = 'course'
permission_classes
=
(
IsProfessorCoordinatorOrAdminPermissionOrReadOnly
,
)
serializer_class
=
CertificateTemplateSerializer
...
...
@@ -117,7 +117,7 @@ class CertificateTemplateViewSet(viewsets.ModelViewSet):
return
CertificateTemplateSerializer
@
action
(
detail
=
True
,
methods
=
[
'get'
,
'post'
])
def
images
(
self
,
request
,
course
=
None
):
def
images
(
self
,
request
,
pk
=
None
):
obj
=
self
.
get_object
()
errors
=
[]
...
...
@@ -223,9 +223,11 @@ class CourseCertificationDetailView(DetailView):
certificate
.
course_student
.
finish_date
.
year
)
workspace
=
context
[
'cert_template'
].
workspace
w_name
=
workspace
.
name
if
workspace
else
''
context
[
'cert_template'
].
text
=
context
[
'cert_template'
].
text
\
.
replace
(
'{NOME}'
,
certificate
.
student
.
get_full_name
())
\
.
replace
(
'{CONTRATO}'
,
context
[
'cert_template'
].
workspace
.
name
)
\
.
replace
(
'{CONTRATO}'
,
w_
name
)
\
.
replace
(
'{NUM_UNIDADES}'
,
str
(
certificate
.
course_total_units
))
\
.
replace
(
'{HORAS}'
,
str
(
certificate
.
course
.
course_load
))
\
.
replace
(
'{TURMA}'
,
certificate
.
course_student
.
get_current_class
().
name
)
\
...
...
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