Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
daeb2f29
Commit
daeb2f29
authored
Apr 26, 2017
by
Joshua Casey
Browse files
[#140655219] #32 Added name on transcript api response
parent
ed4ac06e
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/models/accounts.py
View file @
daeb2f29
...
...
@@ -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
))
...
...
core/views/vacancies.py
View file @
daeb2f29
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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