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
b5b558fc
Commit
b5b558fc
authored
Oct 06, 2019
by
HANIF AGUNG PRAYOGA
Browse files
1606884344 58
parent
22598da9
Changes
6
Hide whitespace changes
Inline
Side-by-side
assets/js/ProfilePage.jsx
View file @
b5b558fc
...
...
@@ -30,6 +30,7 @@ export default class ProfilePage extends React.Component {
phone_number
:
''
,
show_transcript
:
''
,
photo
:
''
,
intro
:
''
,
form
:
{
picture
:
''
,
email
:
''
,
...
...
@@ -37,6 +38,7 @@ export default class ProfilePage extends React.Component {
region
:
''
,
resume
:
''
,
show_transcript
:
''
,
intro
:
''
,
},
bagikanTranskrip
:
''
,
acceptedNo
:
0
,
...
...
@@ -75,6 +77,7 @@ export default class ProfilePage extends React.Component {
acceptedNo
:
data
.
accepted_no
,
bagikanTranskrip
:
data
.
show_transcript
,
refresh
:
this
.
state
.
refresh
+
1
,
intro
:
data
.
intro
,
linkedin_url
:
data
.
linkedin_url
,
});
if
(
this
.
props
.
route
.
own
)
{
...
...
@@ -172,6 +175,10 @@ export default class ProfilePage extends React.Component {
<
label
htmlFor
=
"resume"
>
Resume
</
label
>
<
input
onChange
=
{
this
.
handleFile
}
placeholder
=
"Resume"
name
=
"resume"
type
=
"File"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"intro"
>
Intro
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"Ceritakan dirimu secara singkat"
name
=
"intro"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
Checkbox
onChange
=
{
this
.
handleCheckbox
}
...
...
@@ -277,6 +284,20 @@ export default class ProfilePage extends React.Component {
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
<
Grid
.
Column
width
=
{
2
}
>
<
h3
>
Intro
</
h3
>
</
Grid
.
Column
>
<
Grid
.
Column
width
=
{
13
}
>
<
p
>
{
this
.
state
.
intro
||
'
N/A
'
}
</
p
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
<
Container
textAlign
=
"center"
>
<
div
className
=
"buttonProfile"
>
<
Button
onClick
=
{
this
.
gotoStudentResume
}
disabled
=
{
!
this
.
state
.
resume
}
primary
size
=
"small"
>
Resume
</
Button
>
...
...
core/migrations/0018_student_intro.py
0 → 100644
View file @
b5b558fc
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-05 22:59
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0017_merge_20191006_0134'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'intro'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
50
,
null
=
True
),
),
]
core/migrations/0019_merge_20191006_0852.py
0 → 100644
View file @
b5b558fc
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 01:52
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0018_student_intro'
),
(
'core'
,
'0018_merge_20191006_0603'
),
]
operations
=
[
]
core/models/accounts.py
View file @
b5b558fc
...
...
@@ -67,6 +67,8 @@ class Student(models.Model):
photo
=
models
.
FileField
(
upload_to
=
get_student_photo_file_path
,
null
=
True
,
blank
=
True
,
validators
=
[
validate_image_file_extension
])
linkedin_url
=
models
.
URLField
(
max_length
=
200
,
blank
=
True
,
null
=
True
)
region
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
null
=
True
)
intro
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
,
null
=
True
)
@
property
def
name
(
self
):
...
...
core/serializers/accounts.py
View file @
b5b558fc
...
...
@@ -19,7 +19,7 @@ class StudentSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Student
fields
=
[
'id'
,
'name'
,
'user'
,
'npm'
,
'resume'
,
'phone_number'
,
'birth_place'
,
'birth_date'
,
'major'
,
'batch'
,
\
'show_transcript'
,
'photo'
,
'accepted_no'
,
'linkedin_url'
,
'region'
]
'show_transcript'
,
'photo'
,
'accepted_no'
,
'linkedin_url'
,
'region'
,
'intro'
]
def
get_accepted_no
(
self
,
obj
):
apps
=
Application
.
objects
.
filter
(
student
=
obj
,
status
=
4
)
...
...
@@ -44,6 +44,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'region'
:
instance
.
region
,
'photo'
:
photo
,
'show_transcript'
:
instance
.
show_transcript
,
'intro'
:
instance
.
intro
,
'linkedin_url'
:
instance
.
linkedin_url
,
}
...
...
@@ -54,6 +55,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance
.
region
=
validated_data
.
get
(
'region'
,
instance
.
region
)
instance
.
photo
=
validated_data
.
get
(
'photo'
,
instance
.
photo
)
instance
.
user
.
email
=
validated_data
.
get
(
'email'
,
instance
.
user
.
email
)
instance
.
intro
=
validated_data
.
get
(
'intro'
,
instance
.
intro
)
instance
.
linkedin_url
=
validated_data
.
get
(
'linkedin_url'
,
instance
.
linkedin_url
)
instance
.
save
()
instance
.
user
.
save
()
...
...
@@ -61,7 +63,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Student
fields
=
[
'resume'
,
'email'
,
'phone_number'
,
'photo'
,
'show_transcript'
,
'linkedin_url'
,
'region'
]
fields
=
[
'resume'
,
'email'
,
'phone_number'
,
'photo'
,
'show_transcript'
,
'linkedin_url'
,
'region'
,
'intro'
]
class
CompanyUpdateSerializer
(
serializers
.
ModelSerializer
):
...
...
core/tests/test_accounts.py
View file @
b5b558fc
...
...
@@ -163,3 +163,8 @@ class ProfileUpdateTests(APITestCase):
url
=
'/api/students/'
+
str
(
new_student
.
pk
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'phone_number'
:
'08123123123'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
url
=
'/api/students/'
+
str
(
student_id
)
+
'/profile/'
response
=
self
.
client
.
patch
(
url
,
{
'intro'
:
'Saya tertarik dengan dunia front-end development'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'intro'
),
'Saya tertarik dengan dunia front-end development'
)
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