Fakultas Ilmu Komputer UI

Commit 69150d42 authored by HANIF AGUNG PRAYOGA's avatar HANIF AGUNG PRAYOGA
Browse files

Merge branch '1606884344-58' into 'master'

1606884344 58

See merge request !13
parents 22598da9 b5b558fc
Pipeline #21872 passed with stages
in 51 minutes and 25 seconds
......@@ -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>
......
# -*- 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),
),
]
# -*- 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 = [
]
......@@ -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):
......
......@@ -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):
......
......@@ -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')
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