diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index ef69a5c6535bfe7ffcd9d57028f3378425a2ea9c..b008b649d6c9528a5ba0835b12f316b315afa6a4 100755 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -354,11 +354,7 @@ export default class ProfilePage extends React.Component { </Form.Field> <Form.Field> <label htmlFor="self_description">Deskripsi Diri</label> - <input - onChange={this.handleChange} - placeholder="Saya suka belajar" - name="self_description" - /> + <input onChange={this.handleChange} maxlength="500" placeholder="Saya suka belajar" name="self_description" /> </Form.Field> <Form.Field> <label htmlFor="linkedin_url">URL Profile LinkedIn</label> diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index 4bb9a87641e6ee3f08c79fcbb48d595d37a59d63..5d4a9e472b949e9b0ecbeebcb2fbca9689676eee 100644 --- a/core/migrations/0001_initial.py +++ b/core/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-14 14:00 +# Generated by Django 1.11.17 on 2019-11-15 11:27 from __future__ import unicode_literals import core.lib.validators @@ -37,8 +37,8 @@ class Migration(migrations.Migration): ('status', models.IntegerField(default=0)), ('logo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_company_logo_file_path, validators=[core.lib.validators.validate_image_file_extension])), ('address', models.CharField(blank=True, max_length=1000, null=True)), - ('category', models.CharField(default=b'Belum ada kategori perusahaan', max_length=140)), - ('website', models.CharField(default=b'Belum ada link website', max_length=100)), + ('category', models.CharField(default='Belum ada kategori perusahaan', max_length=140)), + ('website', models.CharField(default='Belum ada link website', max_length=100)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ @@ -50,7 +50,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(auto_now_add=True)), - ('title', models.CharField(blank=True, default=b'', max_length=100)), + ('title', models.CharField(blank=True, default='', max_length=100)), ('content', models.TextField()), ], options={ @@ -64,16 +64,16 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('npm', models.IntegerField(unique=True, validators=[core.lib.validators.validate_npm])), - ('resume', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator([b'pdf'])])), + ('resume', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator(['pdf'])])), ('sertifikat', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_sertifikat_file_path, validators=[core.lib.validators.validate_document_file_extension])), - ('phone_number', models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator(b'^0\\d{1,11}$')])), + ('phone_number', models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator('^0\\d{1,11}$')])), ('gender', models.CharField(blank=True, max_length=30, null=True)), ('birth_place', models.CharField(blank=True, max_length=30, null=True)), ('birth_date', models.DateField(blank=True, null=True)), ('major', models.CharField(blank=True, max_length=30, null=True)), ('batch', models.CharField(blank=True, max_length=4, null=True)), ('show_transcript', models.BooleanField(default=False)), - ('photo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator([b'jpg', b'jpeg', b'png'])])), + ('photo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'png'])])), ('self_description', models.CharField(blank=True, db_index=True, max_length=500, null=True)), ('portfolio_link', models.URLField(blank=True, null=True)), ('linkedin_url', models.URLField(blank=True, null=True)), @@ -91,14 +91,15 @@ class Migration(migrations.Migration): ('intro', models.CharField(blank=True, max_length=50, null=True)), ('expected_salary', models.CharField(blank=True, max_length=10, null=True)), ('job_seeking_status', models.CharField(blank=True, max_length=30, null=True)), - ('student_gpa', models.FloatField(blank=True, db_column=b'student_gpa', default=1.0, null=True)), + ('student_gpa', models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True, validators=[core.lib.validators.validate_student_gpa])), ('volunteer', models.CharField(blank=True, max_length=100, null=True)), ('awards', models.CharField(blank=True, max_length=100, null=True)), ('projects', models.CharField(blank=True, max_length=100, null=True)), ('certification', models.CharField(blank=True, max_length=100, null=True)), ('languages', models.CharField(blank=True, max_length=100, null=True)), ('seminar', models.CharField(blank=True, max_length=100, null=True)), - ('dependants', models.IntegerField(blank=True, db_column=b'dependants', default=0, null=True)), + ('interests', models.CharField(blank=True, max_length=100, null=True)), + ('dependants', models.IntegerField(blank=True, db_column='dependants', default=0, null=True)), ], options={ 'ordering': ['-updated'], @@ -110,7 +111,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), - ('nip', models.IntegerField(unique=True, validators=[django.core.validators.MinValueValidator(100000000), django.core.validators.MaxValueValidator(9999999999L)])), + ('nip', models.IntegerField(unique=True, validators=[django.core.validators.MinValueValidator(100000000), django.core.validators.MaxValueValidator(9999999999)])), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ @@ -158,7 +159,7 @@ class Migration(migrations.Migration): name='ReasonRejected', fields=[ ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='core.Application')), - ('reason', models.TextField(default=b'Tidak memenuhi kualifikasi perusahaan.')), + ('reason', models.TextField(default='Tidak memenuhi kualifikasi perusahaan.')), ], ), migrations.AddField( diff --git a/core/migrations/0002_auto_20191109_2249.py b/core/migrations/0002_auto_20191109_2249.py deleted file mode 100644 index cd458a2018f86602fb22f8fbdcd0e8264d9faef7..0000000000000000000000000000000000000000 --- a/core/migrations/0002_auto_20191109_2249.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-09 15:49 -from __future__ import unicode_literals - -import core.models.accounts -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='company', - name='category', - field=models.CharField(default='Belum ada kategori perusahaan', max_length=140), - ), - migrations.AlterField( - model_name='company', - name='website', - field=models.CharField(default='Belum ada link website', max_length=100), - ), - migrations.AlterField( - model_name='feedback', - name='title', - field=models.CharField(blank=True, default='', max_length=100), - ), - migrations.AlterField( - model_name='reasonrejected', - name='reason', - field=models.TextField(default='Tidak memenuhi kualifikasi perusahaan.'), - ), - 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}$')]), - ), - migrations.AlterField( - model_name='student', - name='photo', - field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'png'])]), - ), - migrations.AlterField( - model_name='student', - name='resume', - field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator(['pdf'])]), - ), - migrations.AlterField( - model_name='student', - name='student_gpa', - field=models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True), - ), - ] diff --git a/core/migrations/0002_auto_20191114_1728.py b/core/migrations/0002_auto_20191114_1728.py deleted file mode 100644 index ff126243781cfe9417f694d1c8e7bee5d23af2c3..0000000000000000000000000000000000000000 --- a/core/migrations/0002_auto_20191114_1728.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-14 10:28 -from __future__ import unicode_literals - -import core.models.accounts -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='company', - name='category', - field=models.CharField(default='Belum ada kategori perusahaan', max_length=140), - ), - migrations.AlterField( - model_name='company', - name='website', - field=models.CharField(default='Belum ada link website', max_length=100), - ), - migrations.AlterField( - model_name='feedback', - name='title', - field=models.CharField(blank=True, default='', max_length=100), - ), - migrations.AlterField( - model_name='reasonrejected', - name='reason', - field=models.TextField(default='Tidak memenuhi kualifikasi perusahaan.'), - ), - 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}$')]), - ), - migrations.AlterField( - model_name='student', - name='photo', - field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'png'])]), - ), - migrations.AlterField( - model_name='student', - name='resume', - field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator(['pdf'])]), - ), - migrations.AlterField( - model_name='student', - name='student_gpa', - field=models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True), - ), - ] diff --git a/core/migrations/0002_student_interest.py b/core/migrations/0002_student_interest.py deleted file mode 100644 index c57bb171587221d4fdb5a40721e696df669f25c0..0000000000000000000000000000000000000000 --- a/core/migrations/0002_student_interest.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-15 01:18 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='student', - name='interest', - field=models.CharField(blank=True, max_length=100, null=True), - ), - ] diff --git a/core/migrations/0003_auto_20191115_0855.py b/core/migrations/0003_auto_20191115_0855.py deleted file mode 100644 index 557a253d56809992e3e1ceb241d0843e3106564f..0000000000000000000000000000000000000000 --- a/core/migrations/0003_auto_20191115_0855.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-15 01:55 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0002_student_interest'), - ] - - operations = [ - migrations.RenameField( - model_name='student', - old_name='interest', - new_name='interests', - ), - ] diff --git a/core/migrations/0004_merge_20191115_1041.py b/core/migrations/0004_merge_20191115_1041.py deleted file mode 100644 index bdb99cb6ba5f525e2299e00085127cce7c35f998..0000000000000000000000000000000000000000 --- a/core/migrations/0004_merge_20191115_1041.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-15 03:41 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0003_auto_20191115_0855'), - ('core', '0002_auto_20191109_2249'), - ] - - operations = [ - ] diff --git a/core/migrations/0005_merge_20191115_1314.py b/core/migrations/0005_merge_20191115_1314.py deleted file mode 100644 index e8bb0d729cace7037fedb4c72b77cc0b36eca394..0000000000000000000000000000000000000000 --- a/core/migrations/0005_merge_20191115_1314.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-15 06:14 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0002_auto_20191114_1728'), - ('core', '0004_merge_20191115_1041'), - ] - - operations = [ - ] diff --git a/core/migrations/0006_auto_20191115_1409.py b/core/migrations/0006_auto_20191115_1409.py deleted file mode 100644 index cc191b74483334ac2dab272d78e5647c381cd600..0000000000000000000000000000000000000000 --- a/core/migrations/0006_auto_20191115_1409.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-11-15 07:09 -from __future__ import unicode_literals - -import core.lib.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0005_merge_20191115_1314'), - ] - - operations = [ - migrations.AlterField( - model_name='student', - name='student_gpa', - field=models.FloatField(blank=True, db_column=b'student_gpa', default=1.0, null=True, validators=[core.lib.validators.validate_student_gpa]), - ), - ] diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py index a66c95faf0f0d38f7fa368438bf4519230a11761..6c1dab9705ff5c1698a6ef3205691f0923770fc4 100755 --- a/core/tests/test_accounts.py +++ b/core/tests/test_accounts.py @@ -237,6 +237,11 @@ class ProfileUpdateTests(APITestCase): self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) self.assertEqual(response.data.get('seminar'), 'Seminar CompFest') + failing_desc = "a" * 501 + url = '/api/students/' + str(student_id) + "/profile/" + response = self.client.patch(url, {'self_description': failing_desc}, format='multipart') + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + url = '/api/students/' + str(student_id) + "/profile/" response = self.client.patch(url, {'student_gpa': '4'}, format='multipart') self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)