Commit ede1052b authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Update CertificateTemplate view

parent d1b1976a
......@@ -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)\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment