Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kape
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMPL
Class Project
Kape
Commits
c12ef274
Commit
c12ef274
authored
5 years ago
by
Ivana Irene Thomas
Browse files
Options
Downloads
Patches
Plain Diff
allow users to edit major, batch, birth date, and birth place
parent
3f5d4a09
No related branches found
No related tags found
No related merge requests found
Pipeline
#21459
passed
5 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/js/ProfilePage.jsx
+22
-5
22 additions, 5 deletions
assets/js/ProfilePage.jsx
core/serializers/accounts.py
+11
-2
11 additions, 2 deletions
core/serializers/accounts.py
with
33 additions
and
7 deletions
assets/js/ProfilePage.jsx
+
22
−
5
View file @
c12ef274
...
...
@@ -23,8 +23,8 @@ export default class ProfilePage extends React.Component {
major
:
''
,
batch
:
''
,
email
:
''
,
cityOfBirth
:
''
,
dateOfBirth
:
''
,
birth_place
:
''
,
birth_date
:
''
,
resume
:
''
,
phone_number
:
''
,
show_transcript
:
''
,
...
...
@@ -63,8 +63,8 @@ export default class ProfilePage extends React.Component {
major
:
data
.
major
,
batch
:
data
.
batch
,
email
:
data
.
user
.
email
,
cityOfBirth
:
data
.
birth_place
,
dateOfBirth
:
data
.
birth_date
,
birth_place
:
data
.
birth_place
,
birth_date
:
data
.
birth_date
,
phone_number
:
data
.
phone_number
,
photo
:
data
.
photo
,
show_transcript
:
data
.
show_transcript
,
...
...
@@ -92,6 +92,7 @@ export default class ProfilePage extends React.Component {
submitForm
[
key
]
=
this
.
state
.
form
[
key
];
}
});
console
.
log
(
submitForm
)
this
.
setState
({
loading
:
true
});
Server
.
submit
(
`/students/
${
this
.
state
.
id
}
/profile/`
,
submitForm
,
'
PATCH
'
).
then
(()
=>
{
this
.
setState
({
loading
:
false
});
...
...
@@ -146,6 +147,22 @@ export default class ProfilePage extends React.Component {
<
label
htmlFor
=
"photo"
>
Profile Picture
</
label
>
<
input
onChange
=
{
this
.
handleFile
}
placeholder
=
"Profile Photo.jpg"
name
=
"photo"
type
=
"File"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"photo"
>
Date of Birth (YYYY-MM-DD)
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"1999-01-01"
name
=
"birth_date"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"photo"
>
Birth Place
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"Semarang"
name
=
"birth_place"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"photo"
>
Major
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"Ilmu Komputer"
name
=
"major"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"photo"
>
Batch
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"2016"
name
=
"batch"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"email"
>
Email
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"jojon@email.com"
name
=
"email"
/>
...
...
@@ -235,7 +252,7 @@ export default class ProfilePage extends React.Component {
<
Icon
name
=
"gift"
size
=
"big"
/>
</
Grid
.
Column
>
<
Grid
.
Column
width
=
{
13
}
>
<
p
>
{
this
.
state
.
cityOfBirth
||
'
N/A
'
}
,
{
this
.
state
.
dateOfBirth
||
'
N/A
'
}
</
p
>
<
p
>
{
this
.
state
.
birth_place
||
'
N/A
'
}
,
{
this
.
state
.
birth_date
||
'
N/A
'
}
</
p
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
...
...
This diff is collapsed.
Click to expand it.
core/serializers/accounts.py
+
11
−
2
View file @
c12ef274
...
...
@@ -42,22 +42,31 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'
email
'
:
instance
.
user
.
email
,
'
phone_number
'
:
instance
.
phone_number
,
'
photo
'
:
photo
,
'
show_transcript
'
:
instance
.
show_transcript
'
show_transcript
'
:
instance
.
show_transcript
,
'
birth_date
'
:
instance
.
birth_date
,
'
birth_place
'
:
instance
.
birth_place
,
'
major
'
:
instance
.
major
,
'
batch
'
:
instance
.
batch
}
def
update
(
self
,
instance
,
validated_data
):
print
(
validated_data
)
instance
.
resume
=
validated_data
.
get
(
'
resume
'
,
instance
.
resume
)
instance
.
show_transcript
=
validated_data
.
get
(
'
show_transcript
'
,
instance
.
show_transcript
)
instance
.
phone_number
=
validated_data
.
get
(
'
phone_number
'
,
instance
.
phone_number
)
instance
.
photo
=
validated_data
.
get
(
'
photo
'
,
instance
.
photo
)
instance
.
user
.
email
=
validated_data
.
get
(
'
email
'
,
instance
.
user
.
email
)
instance
.
birth_date
=
validated_data
.
get
(
'
birth_date
'
,
instance
.
birth_date
)
instance
.
birth_place
=
validated_data
.
get
(
'
birth_place
'
,
instance
.
birth_place
)
instance
.
major
=
validated_data
.
get
(
'
major
'
,
instance
.
major
)
instance
.
batch
=
validated_data
.
get
(
'
batch
'
,
instance
.
batch
)
instance
.
save
()
instance
.
user
.
save
()
return
instance
class
Meta
:
model
=
Student
fields
=
[
'
resume
'
,
'
email
'
,
'
phone_number
'
,
'
photo
'
,
'
show_transcript
'
]
fields
=
[
'
resume
'
,
'
email
'
,
'
phone_number
'
,
'
photo
'
,
'
show_transcript
'
,
'
birth_date
'
,
'
birth_place
'
,
'
major
'
,
'
batch
'
]
class
CompanyUpdateSerializer
(
serializers
.
ModelSerializer
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment