diff --git a/core/models/accounts.py b/core/models/accounts.py index 607a4550387bca27204c0d323c5e5d2f66df9123..7fd1d71681bf91579b31a4fa45545d884b4ed0ad 100644 --- a/core/models/accounts.py +++ b/core/models/accounts.py @@ -68,6 +68,10 @@ class Student(models.Model): def name(self): return get_display_name(self.user) + @property + def full_name(self): + return get_display_name(self.user, full_name=True) + def __unicode__(self): return u"Student {}".format(get_display_name(self.user)) diff --git a/core/views/vacancies.py b/core/views/vacancies.py index f11b55095777b8e0d1557fb01ad407147cbfd83e..c0eebcc245e5bb3f4c32886dc4d0ebff1859ce92 100644 --- a/core/views/vacancies.py +++ b/core/views/vacancies.py @@ -121,11 +121,11 @@ class CompanyApplicationStatusViewSet(viewsets.GenericViewSet): credentials = settings.API_CS_CREDENTIALS s.get('https://api.cs.ui.ac.id/api-auth/login/') csrf = s.cookies['csrftoken'] - s.post('https://api.cs.ui.ac.id/api-auth/login/', data={'username' : credentials["user"], 'password' : credentials["password"], 'csrfmiddlewaretoken' : csrf}) + resp = s.post('https://api.cs.ui.ac.id/api-auth/login/', data={'username' : credentials["user"], 'password' : credentials["password"], 'csrfmiddlewaretoken' : csrf}) response = s.get('https://api.cs.ui.ac.id/siakngcs/mahasiswa/' + str(student.npm) + '/riwayat/') - return Response(response.json(), status=status.HTTP_200_OK) + return Response({'name' : student.full_name, 'transcript' : response.json()}, status=status.HTTP_200_OK) else: - return Response({'error' : 'student does not allow transcript to be shown'}, status=status.HTTP_200_OK) + return Response({'name' : student.full_name, 'error' : 'student does not allow transcript to be shown'}, status=status.HTTP_200_OK) class CompanyVacanciesViewSet(viewsets.GenericViewSet):