Fakultas Ilmu Komputer UI

Commit 2f44120d authored by Kevin Albert Simanjuntak's avatar Kevin Albert Simanjuntak
Browse files

implement field work_experience(student)

parent 0bee27ba
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 16:37
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', '0014_auto_20191004_1340'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-11 14:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0020_merge_20191006_2337'),
('core', '0052_merge_20191011_1837'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 05:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0053_merge_20191011_2128'),
('core', '0055_merge_20191012_1043'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 06:12
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0056_merge_20191012_1256'),
]
operations = [
migrations.AddField(
model_name='student',
name='work_experience',
field=models.CharField(blank=True, max_length=500, null=True),
),
migrations.AlterField(
model_name='student',
name='phone_number',
field=models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator('^0\\d{1,11}$')]),
),
]
......@@ -80,6 +80,7 @@ class Student(models.Model):
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)
work_experience = models.CharField(max_length=500, blank=True, null=True)
region = models.CharField(max_length=30, blank=True, null=True)
skills = models.CharField(max_length=50, blank=True, null=True)
recommendations = models.CharField(max_length=500, blank=True, null=True)
......
......@@ -21,7 +21,7 @@ class StudentSerializer(serializers.ModelSerializer):
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', 'portfolio_link', 'website_url', 'student_gpa', 'age','recommendations',
'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'work_experience', 'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description', 'github_url']
def get_accepted_no(self, obj):
......@@ -63,6 +63,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'volunteer': instance.volunteer,
'linkedin_url': instance.linkedin_url,
'recommendations': instance.recommendations,
'work_experience': instance.work_experience,
'latest_work': instance.latest_work,
'latest_work_desc': instance.latest_work_desc,
'skills': instance.skills,
......@@ -87,6 +88,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.student_gpa = validated_data.get('student_gpa', instance.student_gpa)
instance.website_url = validated_data.get('website_url', instance.website_url)
instance.skills = validated_data.get('skills', instance.skills)
instance.work_experience = validated_data.get('work_experience', instance.work_experience)
instance.recommendations = validated_data.get('recommendations', instance.recommendations)
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)
......@@ -98,7 +100,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
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', \
'recommendations', 'work_experience', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description', 'github_url']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -265,6 +265,12 @@ class ProfileUpdateTests(APITestCase):
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'github_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + '/profile/'
response = self.client.patch(url, {'work_experience': 'Magang 3 bulan di Pusilkom'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('work_experience'), 'Magang 3 bulan di Pusilkom')
def _create_test_file(self,path):
f = open(path, 'r')
......
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