Fakultas Ilmu Komputer UI

Commit 0166ed6b authored by Metta Anantha Pindika's avatar Metta Anantha Pindika
Browse files

1606876046 42

parent 86dda5f2
......@@ -29,6 +29,7 @@ export default class ProfilePage extends React.Component {
dateOfBirth: '',
resume: '',
phone_number: '',
portfolio_link: '',
show_transcript: '',
photo: '',
age: '',
......@@ -45,6 +46,7 @@ export default class ProfilePage extends React.Component {
region: '',
skills: '',
resume: '',
portfolio_link: '',
show_transcript: '',
volunteer: '',
intro: '',
......@@ -93,6 +95,7 @@ export default class ProfilePage extends React.Component {
cityOfBirth: data.birth_place,
dateOfBirth: this.parseIndonesianDateFormat(data.birth_date),
phone_number: data.phone_number,
portfolio_link: data.portfolio_link,
photo: data.photo,
show_transcript: data.show_transcript,
acceptedNo: data.accepted_no,
......@@ -276,6 +279,16 @@ export default class ProfilePage extends React.Component {
name="linkedin_url"
/>
</Form.Field>
<Form.Field>
<label htmlFor="portfolio_link">Portfolio Link</label>
<input
onChange={this.handleChange}
placeholder={this.state.portfolio_link === null ? 'https://www.example.com/myproject/' :
this.state.portfolio_link}
defaultValue={this.state.portfolio_link === null ? null : this.state.portfolio_link}
name="portfolio_link"
/>
</Form.Field>
<Form.Field>
<label htmlFor="website_url">Website URL</label>
<input
......@@ -436,6 +449,17 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="linkify" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<a href={this.state.portfolio_link}> {this.state.portfolio_link || 'N/A'} </a>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 10:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_auto_20170602_1130'),
]
operations = [
migrations.AddField(
model_name='student',
name='portfolio_link',
field=models.URLField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 13:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0017_vacancy_amount'),
('core', '0019_merge_20191006_0852'),
('core', '0014_student_portfolio_link'),
('core', '0014_auto_20191004_1340'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 02:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0047_merge_20191011_0029'),
('core', '0020_merge_20191006_2021'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 03:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0054_merge_20191012_1018'),
('core', '0048_merge_20191012_0956'),
]
operations = [
]
......@@ -77,6 +77,7 @@ class Student(models.Model):
show_transcript = models.BooleanField(default=False)
self_description = models.CharField(max_length=500, blank=True, db_index=True, null=True)
photo = models.FileField(upload_to=get_student_photo_file_path, null=True, blank=True, validators=[validate_image_file_extension])
portfolio_link = models.URLField(blank=True, null=True)
linkedin_url = models.URLField(max_length=200,blank=True, null=True)
website_url = models.URLField(max_length=200,blank=True, null=True)
region = models.CharField(max_length=30, blank=True, null=True)
......
......@@ -20,7 +20,7 @@ class StudentSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'gender','birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa', 'age','recommendations',
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'portfolio_link', 'website_url', 'student_gpa', 'age','recommendations',
'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description', 'github_url']
......@@ -53,6 +53,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'region': instance.region,
'photo': photo,
'show_transcript': instance.show_transcript,
'portfolio_link': instance.portfolio_link,
'self_description': instance.self_description,
'intro': instance.intro,
'expected_salary': instance.expected_salary,
......@@ -76,6 +77,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.portfolio_link = validated_data.get('portfolio_link', instance.portfolio_link)
instance.self_description = validated_data.get('self_description', instance.self_description)
instance.intro = validated_data.get('intro', instance.intro)
instance.expected_salary = validated_data.get('expected_salary', instance.expected_salary)
......@@ -95,11 +97,10 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'gender','photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa',
fields = ['resume', 'email', 'phone_number', 'gender','photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'portfolio_link', 'website_url', 'student_gpa',
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description', 'github_url']
class CompanyUpdateSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
logo = None
......
......@@ -153,7 +153,15 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.data.get('phone_number'), '08123123123')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'portfolio_link': 'https://www.example.com/myproject'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('portfolio_link'), 'https://www.example.com/myproject')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'portfolio_link': 'asdfghjkl'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'self_description': 'I am very happy'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('self_description'), 'I am very happy')
......
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