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
0f3b6725
Commit
0f3b6725
authored
Nov 14, 2019
by
Dwi Nanda Susanto
Browse files
1506722720-127
parent
1f4449d8
Changes
7
Hide whitespace changes
Inline
Side-by-side
assets/js/EditProfile.jsx
View file @
0f3b6725
...
...
@@ -82,6 +82,7 @@ export default class ProfilePage extends React.Component {
certification
:
''
,
languages
:
''
,
seminar
:
''
,
dependants
:
''
,
};
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
...
...
@@ -472,6 +473,15 @@ export default class ProfilePage extends React.Component {
name
=
"student_gpa"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"dependants"
>
Dependants
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
{
this
.
state
.
dependants
===
null
?
'
0
'
:
this
.
state
.
dependants
}
defaultValue
=
{
this
.
state
.
dependants
===
null
?
null
:
this
.
state
.
dependants
}
name
=
"dependants"
/>
</
Form
.
Field
>
<
Button
type
=
"submit"
size
=
"small"
loading
=
{
this
.
state
.
loading
}
primary
floated
=
"right"
>
Submit
</
Button
>
</
Form
>
...
...
assets/js/ProfilePage.jsx
View file @
0f3b6725
...
...
@@ -80,6 +80,7 @@ export default class ProfilePage extends React.Component {
certification
:
''
,
languages
:
''
,
semimar
:
''
,
dependants
:
''
,
};
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
...
...
@@ -135,6 +136,7 @@ export default class ProfilePage extends React.Component {
certification
:
data
.
certification
,
languages
:
data
.
languages
,
seminar
:
data
.
seminar
,
dependants
:
data
.
dependants
,
});
if
(
this
.
props
.
route
.
own
)
{
const
newSession
=
this
.
props
.
user
.
data
;
...
...
@@ -459,6 +461,15 @@ export default class ProfilePage extends React.Component {
name
=
"student_gpa"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"dependants"
>
Dependants
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
{
this
.
state
.
dependants
===
null
?
'
0
'
:
this
.
state
.
dependants
}
defaultValue
=
{
this
.
state
.
dependants
===
null
?
null
:
this
.
state
.
dependants
}
name
=
"dependants"
/>
</
Form
.
Field
>
<
Button
type
=
"submit"
size
=
"small"
loading
=
{
this
.
state
.
loading
}
primary
floated
=
"right"
>
Submit
</
Button
>
</
Form
>
...
...
@@ -599,6 +610,17 @@ export default class ProfilePage extends React.Component {
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
<
Grid
.
Column
width
=
{
2
}
>
<
Icon
name
=
"child"
size
=
"big"
/>
</
Grid
.
Column
>
<
Grid
.
Column
width
=
{
13
}
>
<
a
href
=
{
this
.
state
.
dependants
}
>
{
this
.
state
.
dependants
||
'
null
'
}
</
a
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
<
Grid
.
Column
width
=
{
2
}
>
...
...
core/migrations/0001_initial.py
View file @
0f3b6725
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-14
09:34
# Generated by Django 1.11.17 on 2019-11-14
11:52
from
__future__
import
unicode_literals
import
core.lib.validators
...
...
@@ -37,8 +37,8 @@ class Migration(migrations.Migration):
(
'status'
,
models
.
IntegerField
(
default
=
0
)),
(
'logo'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_company_logo_file_path
,
validators
=
[
core
.
lib
.
validators
.
validate_image_file_extension
])),
(
'address'
,
models
.
CharField
(
blank
=
True
,
max_length
=
1000
,
null
=
True
)),
(
'category'
,
models
.
CharField
(
default
=
b
'Belum ada kategori perusahaan'
,
max_length
=
140
)),
(
'website'
,
models
.
CharField
(
default
=
b
'Belum ada link website'
,
max_length
=
100
)),
(
'category'
,
models
.
CharField
(
default
=
'Belum ada kategori perusahaan'
,
max_length
=
140
)),
(
'website'
,
models
.
CharField
(
default
=
'Belum ada link website'
,
max_length
=
100
)),
(
'user'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
)),
],
options
=
{
...
...
@@ -50,7 +50,7 @@ class Migration(migrations.Migration):
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'created'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'title'
,
models
.
CharField
(
blank
=
True
,
default
=
b
''
,
max_length
=
100
)),
(
'title'
,
models
.
CharField
(
blank
=
True
,
default
=
''
,
max_length
=
100
)),
(
'content'
,
models
.
TextField
()),
],
options
=
{
...
...
@@ -64,16 +64,16 @@ class Migration(migrations.Migration):
(
'created'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'updated'
,
models
.
DateTimeField
(
auto_now
=
True
)),
(
'npm'
,
models
.
IntegerField
(
unique
=
True
,
validators
=
[
core
.
lib
.
validators
.
validate_npm
])),
(
'resume'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_student_resume_file_path
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
b
'pdf'
])])),
(
'resume'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_student_resume_file_path
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
'pdf'
])])),
(
'sertifikat'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_student_sertifikat_file_path
,
validators
=
[
core
.
lib
.
validators
.
validate_document_file_extension
])),
(
'phone_number'
,
models
.
CharField
(
blank
=
True
,
db_index
=
True
,
max_length
=
100
,
null
=
True
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
b
'^0
\\
d{1,11}$'
)])),
(
'phone_number'
,
models
.
CharField
(
blank
=
True
,
db_index
=
True
,
max_length
=
100
,
null
=
True
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
'^0
\\
d{1,11}$'
)])),
(
'gender'
,
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
)),
(
'birth_place'
,
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
)),
(
'birth_date'
,
models
.
DateField
(
blank
=
True
,
null
=
True
)),
(
'major'
,
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
)),
(
'batch'
,
models
.
CharField
(
blank
=
True
,
max_length
=
4
,
null
=
True
)),
(
'show_transcript'
,
models
.
BooleanField
(
default
=
False
)),
(
'photo'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_student_photo_file_path
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
b
'jpg'
,
b
'jpeg'
,
b
'png'
])])),
(
'photo'
,
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
core
.
models
.
accounts
.
get_student_photo_file_path
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
'jpg'
,
'jpeg'
,
'png'
])])),
(
'self_description'
,
models
.
CharField
(
blank
=
True
,
db_index
=
True
,
max_length
=
500
,
null
=
True
)),
(
'portfolio_link'
,
models
.
URLField
(
blank
=
True
,
null
=
True
)),
(
'linkedin_url'
,
models
.
URLField
(
blank
=
True
,
null
=
True
)),
...
...
@@ -91,13 +91,14 @@ class Migration(migrations.Migration):
(
'intro'
,
models
.
CharField
(
blank
=
True
,
max_length
=
50
,
null
=
True
)),
(
'expected_salary'
,
models
.
CharField
(
blank
=
True
,
max_length
=
10
,
null
=
True
)),
(
'job_seeking_status'
,
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
)),
(
'student_gpa'
,
models
.
FloatField
(
blank
=
True
,
db_column
=
b
'student_gpa'
,
default
=
1.0
,
null
=
True
)),
(
'student_gpa'
,
models
.
FloatField
(
blank
=
True
,
db_column
=
'student_gpa'
,
default
=
1.0
,
null
=
True
)),
(
'volunteer'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'awards'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'projects'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'certification'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'languages'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'seminar'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'dependants'
,
models
.
IntegerField
(
blank
=
True
,
db_column
=
'dependants'
,
default
=
0
,
null
=
True
)),
],
options
=
{
'ordering'
:
[
'-updated'
],
...
...
@@ -109,7 +110,7 @@ class Migration(migrations.Migration):
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'created'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'updated'
,
models
.
DateTimeField
(
auto_now
=
True
)),
(
'nip'
,
models
.
IntegerField
(
unique
=
True
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
100000000
),
django
.
core
.
validators
.
MaxValueValidator
(
9999999999
L
)])),
(
'nip'
,
models
.
IntegerField
(
unique
=
True
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
100000000
),
django
.
core
.
validators
.
MaxValueValidator
(
9999999999
)])),
(
'user'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
)),
],
options
=
{
...
...
@@ -130,7 +131,7 @@ class Migration(migrations.Migration):
(
'updated'
,
models
.
DateTimeField
(
auto_now
=
True
)),
(
'name'
,
models
.
CharField
(
max_length
=
100
)),
(
'amount'
,
models
.
IntegerField
(
null
=
True
)),
(
'max_accepted_applicants'
,
models
.
IntegerField
()),
(
'max_accepted_applicants'
,
models
.
IntegerField
(
default
=
0
)),
(
'benefits'
,
models
.
TextField
(
blank
=
True
)),
(
'working_period'
,
models
.
CharField
(
max_length
=
100
,
null
=
True
)),
(
'tag'
,
models
.
TextField
(
blank
=
True
)),
...
...
@@ -157,7 +158,7 @@ class Migration(migrations.Migration):
name
=
'ReasonRejected'
,
fields
=
[
(
'application'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
primary_key
=
True
,
serialize
=
False
,
to
=
'core.Application'
)),
(
'reason'
,
models
.
TextField
(
default
=
b
'Tidak memenuhi kualifikasi perusahaan.'
)),
(
'reason'
,
models
.
TextField
(
default
=
'Tidak memenuhi kualifikasi perusahaan.'
)),
],
),
migrations
.
AddField
(
...
...
core/models/accounts.py
View file @
0f3b6725
...
...
@@ -106,6 +106,7 @@ class Student(models.Model):
certification
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
languages
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
seminar
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
dependants
=
models
.
IntegerField
(
db_column
=
'dependants'
,
default
=
0
,
blank
=
True
,
null
=
True
)
@
property
def
name
(
self
):
...
...
core/models/vacancies.py
View file @
0f3b6725
...
...
@@ -17,7 +17,7 @@ class Vacancy(models.Model):
updated
=
models
.
DateTimeField
(
auto_now
=
True
)
name
=
models
.
CharField
(
max_length
=
100
,
null
=
False
)
amount
=
models
.
IntegerField
(
null
=
True
)
max_accepted_applicants
=
models
.
IntegerField
()
max_accepted_applicants
=
models
.
IntegerField
(
default
=
0
)
benefits
=
models
.
TextField
(
blank
=
True
)
working_period
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
tag
=
models
.
TextField
(
blank
=
True
)
...
...
core/serializers/accounts.py
View file @
0f3b6725
...
...
@@ -22,7 +22,7 @@ class StudentSerializer(serializers.ModelSerializer):
fields
=
[
'id'
,
'name'
,
'user'
,
'npm'
,
'resume'
,
'phone_number'
,
'gender'
,
'birth_place'
,
'birth_date'
,
'major'
,
'batch'
,
'show_transcript'
,
'photo'
,
'accepted_no'
,
'linkedin_url'
,
'hackerrank_url'
,
'region'
,
'intro'
,
'portfolio_link'
,
'website_url'
,
'student_gpa'
,
'age'
,
'recommendations'
,
'work_experience'
,
'latest_work'
,
'latest_work_desc'
,
'read_no'
,
'volunteer'
,
'job_seeking_status'
,
'skills'
,
'expected_salary'
,
'self_description'
,
'github_url'
,
'awards'
,
'certification'
,
'languages'
,
'seminar'
,
'alamat'
,
'projects'
]
'self_description'
,
'github_url'
,
'awards'
,
'certification'
,
'languages'
,
'seminar'
,
'alamat'
,
'projects'
,
'dependants'
]
def
get_accepted_no
(
self
,
obj
):
apps
=
Application
.
objects
.
filter
(
student
=
obj
,
status
=
4
)
...
...
@@ -74,7 +74,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'projects'
:
instance
.
projects
,
'certification'
:
instance
.
certification
,
'languages'
:
instance
.
languages
,
'seminar'
:
instance
.
seminar
'seminar'
:
instance
.
seminar
,
'dependants'
:
instance
.
dependants
,
}
def
update
(
self
,
instance
,
validated_data
):
...
...
@@ -134,6 +135,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'languages'
,
instance
.
languages
)
instance
.
seminar
=
validated_data
.
get
(
'seminar'
,
instance
.
seminar
)
instance
.
dependants
=
validated_data
.
get
(
'dependants'
,
instance
.
dependants
)
instance
.
save
()
instance
.
user
.
save
()
return
instance
...
...
@@ -142,7 +144,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
model
=
Student
fields
=
[
'resume'
,
'email'
,
'phone_number'
,
'gender'
,
'photo'
,
'show_transcript'
,
'linkedin_url'
,
'hackerrank_url'
,
'region'
,
'intro'
,
'portfolio_link'
,
'website_url'
,
'student_gpa'
,
'recommendations'
,
'work_experience'
,
'latest_work'
,
'latest_work_desc'
,
'volunteer'
,
'job_seeking_status'
,
'skills'
,
'expected_salary'
,
'self_description'
,
'github_url'
,
'awards'
,
'certification'
,
'languages'
,
'seminar'
,
'alamat'
,
'projects'
]
'self_description'
,
'github_url'
,
'awards'
,
'certification'
,
'languages'
,
'seminar'
,
'alamat'
,
'projects'
,
'dependants'
]
class
CompanyUpdateSerializer
(
serializers
.
ModelSerializer
):
...
...
core/tests/test_accounts.py
View file @
0f3b6725
...
...
@@ -302,6 +302,14 @@ class ProfileUpdateTests(APITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'work_experience'
),
'Magang 3 bulan di Pusilkom'
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'dependants'
:
0
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'dependants'
),
0
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'dependants'
:
'this is not valid dependants input'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
def
_create_test_file
(
self
,
path
):
f
=
open
(
path
,
'r'
)
...
...
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