Fakultas Ilmu Komputer UI

Commit c14f3112 authored by Kristianto's avatar Kristianto
Browse files

Merge branch 'master' into '1606889856-38'

# Conflicts:
#   assets/js/ProfilePage.jsx
#   core/serializers/accounts.py
#   core/tests/test_accounts.py
parent 36d3336d
......@@ -39,12 +39,16 @@ export default class ProfilePage extends React.Component {
resume: '',
show_transcript: '',
intro: '',
latest_work: '',
latest_work_desc: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
refresh: 1,
loading: false,
linkedin_url: '',
latest_work: '',
latest_work_desc: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -79,6 +83,8 @@ export default class ProfilePage extends React.Component {
refresh: this.state.refresh + 1,
intro: data.intro,
linkedin_url: data.linkedin_url,
latest_work: data.latest_work,
latest_work_desc: data.latest_work_desc,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -170,7 +176,14 @@ export default class ProfilePage extends React.Component {
<label htmlFor="region">Region</label>
<input onChange={this.handleChange} placeholder="Indonesia" name="region" />
</Form.Field>
<Form.Field>
<label htmlFor="latest_work">Latest Working Experience</label>
<input onChange={this.handleChange} placeholder="Teaching Asssistant at Fasilkom UI" name="latest_work" />
</Form.Field>
<Form.Field>
<label htmlFor="latest_work_desc">Latest Working Experience Description</label>
<input onChange={this.handleChange} placeholder="Evaluate weekly assignment for 15 students" name="latest_work_desc" />
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input onChange={this.handleFile} placeholder="Resume" name="resume" type="File" />
......@@ -271,9 +284,7 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
</div>
<Segment basic vertical>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="map pin" size="big" />
......@@ -283,6 +294,32 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="suitcase" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p>Latest working experience as: <span><b> { this.state.latest_work || 'N/A' } </b></span></p>
<p>Description: <span> { this.state.latest_work_desc || 'N/A' } </span></p>
</Grid.Column>
</Grid>
</Segment>
</div>
<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>
<Segment basic vertical>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 02:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0018_merge_20191006_0603'),
]
operations = [
migrations.AlterField(
model_name='company',
name='category',
field=models.CharField(default='Belum ada kategori perusahaan', max_length=140),
),
migrations.AlterField(
model_name='feedback',
name='title',
field=models.CharField(blank=True, default='', max_length=100),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 08:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0019_auto_20191006_0922'),
]
operations = [
migrations.AddField(
model_name='student',
name='latest_work',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='student',
name='latest_work_desc',
field=models.TextField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 09:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_auto_20191006_1507'),
]
operations = [
migrations.AlterField(
model_name='student',
name='latest_work',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 11:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0019_merge_20191006_0852'),
('core', '0017_vacancy_amount'),
('core', '0021_auto_20191006_1608'),
('core', '0014_auto_20191004_1340'),
]
operations = [
]
......@@ -67,6 +67,9 @@ 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)
latest_work = models.CharField(max_length=100, blank=True, null=True)
latest_work_desc = models.TextField(blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
......
......@@ -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', 'intro']
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'latest_work', 'latest_work_desc']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -46,6 +46,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'linkedin_url' : instance.linkedin_url,
'latest_work': instance.latest_work,
'latest_work_desc': instance.latest_work_desc,
}
def update(self, instance, validated_data):
......@@ -57,13 +59,15 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
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.latest_work = validated_data.get('latest_work', instance.latest_work)
instance.latest_work_desc = validated_data.get('latest_work_desc', instance.latest_work_desc)
instance.save()
instance.user.save()
return instance
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro']
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'latest_work', 'latest_work_desc']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -179,6 +179,16 @@ class ProfileUpdateTests(APITestCase):
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, {'latest_work': 'Teaching assistant at Fasilkom UI'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('latest_work'), 'Teaching assistant at Fasilkom UI')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'latest_work_desc': 'Evaluate weekly assignment for 15 students'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('latest_work_desc'), 'Evaluate weekly assignment for 15 students')
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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment