diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index ce1063debe102884d877ce5c6d9e9c7572a846ea..85a9c23d63557ad50f8cc6ef0e64bd7b76630499 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-16 08:22 +# Generated by Django 1.11.17 on 2019-12-03 03:38 from __future__ import unicode_literals import core.lib.validators @@ -34,12 +34,12 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('description', models.TextField()), - ('status', models.IntegerField(default=0)), + ('status', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2), django.core.validators.MinValueValidator(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)), + ('category', models.CharField(default='Belum ada kategori perusahaan', max_length=140)), ('size', models.CharField(blank=True, default=0, max_length=10, null=True)), - ('website', models.CharField(default=b'Belum ada link website', max_length=100)), + ('website', models.CharField(default='Belum ada link website', max_length=100)), ('linkedin_url', models.URLField(blank=True, null=True)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], @@ -52,7 +52,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()), ('companyId', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Company')), ], @@ -64,7 +64,7 @@ class Migration(migrations.Migration): name='Recommendation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('content', models.TextField()), + ('content', models.TextField(blank=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ], @@ -79,16 +79,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)), @@ -104,9 +104,10 @@ class Migration(migrations.Migration): ('github_url', models.URLField(blank=True, null=True)), ('gitlab_url', models.URLField(blank=True, null=True)), ('intro', models.CharField(blank=True, max_length=50, null=True)), - ('expected_salary', models.CharField(blank=True, max_length=10, null=True, validators=[django.core.validators.RegexValidator(b'^\\d{0,10}$')])), + ('expected_salary', models.CharField(blank=True, max_length=10, null=True, validators=[django.core.validators.RegexValidator('^\\d{0,10}$')])), ('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, validators=[core.lib.validators.validate_student_gpa])), + ('student_gpa', models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True, validators=[core.lib.validators.validate_student_gpa])), + ('student_toefl', models.CharField(blank=True, max_length=3, null=True)), ('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)), @@ -114,7 +115,7 @@ class Migration(migrations.Migration): ('languages', models.CharField(blank=True, max_length=100, null=True)), ('seminar', models.CharField(blank=True, max_length=100, null=True)), ('interests', models.CharField(blank=True, max_length=100, null=True)), - ('dependants', models.IntegerField(blank=True, db_column=b'dependants', default=0, null=True)), + ('dependants', models.IntegerField(blank=True, db_column='dependants', default=0, null=True)), ], options={ 'ordering': ['-updated'], @@ -174,7 +175,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( @@ -200,12 +201,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='recommendation', name='recommendation_giver', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='giver', to='core.Student'), + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='giver', to='core.Student'), ), migrations.AddField( model_name='recommendation', name='recommendation_receiver', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to='core.Student'), + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to='core.Student'), ), migrations.AddField( model_name='feedback', diff --git a/core/migrations/0002_auto_20191116_1550.py b/core/migrations/0002_auto_20191116_1550.py deleted file mode 100644 index 27fe2d0981e8e65a038898bf81f545df8063318f..0000000000000000000000000000000000000000 --- a/core/migrations/0002_auto_20191116_1550.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.17 on 2019-12-01 10:01 -from __future__ import unicode_literals - -import django.core.validators -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='company', - name='status', - field=models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2), django.core.validators.MinValueValidator(0)]), - ), - migrations.AlterField( - model_name='recommendation', - name='content', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='recommendation', - name='recommendation_giver', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='giver', to='core.Student'), - ), - migrations.AlterField( - model_name='recommendation', - name='recommendation_receiver', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receiver', to='core.Student'), - ), - ] diff --git a/core/migrations/0002_auto_20191203_1051.py b/core/migrations/0002_auto_20191203_1051.py new file mode 100644 index 0000000000000000000000000000000000000000..ff119c53e94a0b828302551ecb823acaf6560c7b --- /dev/null +++ b/core/migrations/0002_auto_20191203_1051.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.17 on 2019-12-03 03:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='student', + name='student_toefl', + field=models.IntegerField(blank=True, db_column='toefl', default=0, null=True), + ), + ] diff --git a/core/models/accounts.py b/core/models/accounts.py index b4d64eb899e8c874a5eb0c1c5489609ed8f9547f..1eed5ba3165dc4dd5033d8f4014e6ca7d9c00867 100755 --- a/core/models/accounts.py +++ b/core/models/accounts.py @@ -111,7 +111,7 @@ class Student(models.Model): job_seeking_status = models.CharField(max_length=30, blank=True, null=True) student_gpa = models.FloatField(db_column='student_gpa', default=1.0, blank=True, null=True, validators=[validate_student_gpa]) - student_toefl = models.CharField(max_length=3, blank=True, null=True) + student_toefl = models.IntegerField(db_column='toefl', default=0, blank=True, null=True) volunteer = models.CharField(max_length=100, blank=True, null=True) awards = models.CharField(max_length=100, blank=True, null=True) projects = models.CharField(max_length=100, blank=True, null=True) diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py index 73620364afa4b40def2cc4538d747294dd86f0a9..2cf93921fe2980c83d2f56da0b4d75433c5e4f81 100755 --- a/core/tests/test_accounts.py +++ b/core/tests/test_accounts.py @@ -395,9 +395,9 @@ class ProfileUpdateTests(APITestCase): self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) url = '/api/students/' + str(student_id) + "/profile/" - response = self.client.patch(url, {'TOEFL': 500}, format='multipart') + response = self.client.patch(url, {'TOEFL': 0}, format='multipart') self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) - self.assertEqual(response.data.get('student_toefl'), 500) + self.assertEqual(response.data.get('student_toefl'), 0) url = '/api/students/' + str(student_id) + "/profile/" response = self.client.patch(url, {'student_toefl': 'this is not valid input'}, format='multipart')