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
719313f2
Commit
719313f2
authored
Apr 24, 2017
by
Joshua Casey
Browse files
[#140655219]
#24
Added new data to student model and revised login to accommodate the change
parent
04a682ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/migrations/0007_auto_20170424_0720.py
0 → 100644
View file @
719313f2
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-24 07:20
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0006_auto_20170328_1950'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'batch'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
4
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'birth_date'
,
field
=
models
.
DateField
(
blank
=
True
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'birth_place'
,
field
=
models
.
TextField
(
blank
=
True
,
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'major'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'show_resume'
,
field
=
models
.
BooleanField
(
default
=
False
),
),
]
core/migrations/0008_auto_20170424_0725.py
0 → 100644
View file @
719313f2
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-24 07:25
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0007_auto_20170424_0720'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'student'
,
name
=
'birth_place'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'student'
,
name
=
'major'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
),
),
]
core/models/accounts.py
View file @
719313f2
...
...
@@ -51,6 +51,11 @@ class Student(models.Model):
bookmarked_vacancies
=
models
.
ManyToManyField
(
'core.Vacancy'
,
related_name
=
"bookmarked_vacancies"
,
blank
=
True
)
applied_vacancies
=
models
.
ManyToManyField
(
'core.Vacancy'
,
related_name
=
"applied_vacancies"
,
blank
=
True
,
through
=
'core.Application'
)
birth_place
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
null
=
True
)
birth_date
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
major
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
null
=
True
)
batch
=
models
.
CharField
(
max_length
=
4
,
blank
=
True
,
null
=
True
)
show_resume
=
models
.
BooleanField
(
default
=
False
)
@
property
def
name
(
self
):
...
...
core/views/accounts.py
View file @
719313f2
...
...
@@ -102,11 +102,15 @@ class LoginViewSet(viewsets.GenericViewSet):
login
(
request
,
user
)
if
created
:
if
resp
.
get
(
'nama_role'
)
==
"mahasiswa"
:
student_detail
=
requests
.
get
(
'https://api.cs.ui.ac.id/siakngcs/mahasiswa/{}/'
.
format
(
resp
.
get
(
"kodeidentitas"
)))
resp_student_detail
=
student_detail
.
json
()
student
=
Student
.
objects
.
create
(
user
=
user
,
npm
=
resp
.
get
(
"kodeidentitas"
),
resume
=
None
,
phone_number
=
None
birth_place
=
resp_student_detail
.
get
(
'kota_lahir'
),
birth_date
=
resp_student_detail
.
get
(
'tgl_lahir'
),
major
=
resp_student_detail
.
get
(
'program'
)[
0
].
get
(
'nm_org'
),
batch
=
resp_student_detail
.
get
(
'program'
)[
0
].
get
(
'angkatan'
)
)
student
.
save
()
else
:
...
...
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