Fakultas Ilmu Komputer UI

Commit daeb2f29 authored by Joshua Casey's avatar Joshua Casey
Browse files

[#140655219] #32 Added name on transcript api response

parent ed4ac06e
......@@ -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))
......
......@@ -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):
......
Supports Markdown
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