Fakultas Ilmu Komputer UI

Commit 0e8cadea authored by Izzan Fakhril Islam's avatar Izzan Fakhril Islam
Browse files

Merge branch 'master' into '1606875806-66'

# Conflicts:
#   core/models/accounts.py
parent b6a21832
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 02:06
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.11.17 on 2019-10-06 08:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0019_auto_20191006_0906'),
('core', '0017_vacancy_amount'),
('core', '0019_merge_20191006_0852'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 13:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0014_auto_20191004_1340'),
('core', '0020_merge_20191006_1538'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 13:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0021_merge_20191006_2031'),
]
operations = [
migrations.AddField(
model_name='student',
name='recommendations',
field=models.CharField(blank=True, max_length=500, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-08 09:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0029_merge_20191008_1247'),
('core', '0031_auto_20191008_1608'),
('core', '0022_student_recommendations'),
]
operations = [
]
......@@ -72,6 +72,7 @@ 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)
recommendations = models.CharField(max_length=500, blank=True, null=True)
ui_ux_portofolio = models.FileField(upload_to=get_student_ui_ux_portofolio_file_path, null=True, blank=True, validators=[validate_document_file_extension])
latest_work = models.CharField(max_length=100, blank=True, null=True)
latest_work_desc = models.TextField(blank=True, null=True)
......
......@@ -20,7 +20,8 @@ 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', 'latest_work', 'latest_work_desc','read_no']
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'recommendations',
'latest_work', 'latest_work_desc','read_no']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -51,7 +52,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'photo': photo,
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'linkedin_url' : instance.linkedin_url,
'linkedin_url': instance.linkedin_url,
'recommendations': instance.recommendations,
'latest_work': instance.latest_work,
'latest_work_desc': instance.latest_work_desc,
}
......@@ -65,6 +67,7 @@ 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.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)
instance.save()
......@@ -73,7 +76,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'latest_work', 'latest_work_desc']
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro',
'recommendations', 'latest_work', 'latest_work_desc']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -152,6 +152,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('linkedin_url'), 'https://www.linkedin.com/in/jojo/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'recommendations': 'mantap kak'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('recommendations'), 'mantap kak')
response = self.client.patch(url, {'region': 'Indonesia'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('region'), 'Indonesia')
......@@ -197,7 +202,7 @@ class ProfileUpdateTests(APITestCase):
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)
......
This diff is collapsed.
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