diff --git a/.DS_Store b/.DS_Store new file mode 100755 index 0000000000000000000000000000000000000000..e6072678a3fefd13bceb8078debb57f59ffdb6dd Binary files /dev/null and b/.DS_Store differ diff --git a/core/migrations/0002_auto_20191206_1557.py b/core/migrations/0002_auto_20191206_1557.py new file mode 100644 index 0000000000000000000000000000000000000000..e8dbf8ea180ec948b68e644ba4bc07621816c2e7 --- /dev/null +++ b/core/migrations/0002_auto_20191206_1557.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.8 on 2019-12-06 08:57 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='student', + name='region', + field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^\\w{0,30}$')]), + ), + ] diff --git a/core/migrations/0003_auto_20191206_1600.py b/core/migrations/0003_auto_20191206_1600.py new file mode 100644 index 0000000000000000000000000000000000000000..4df73f3278f918489c1c876bc052cbcbfd3fbae7 --- /dev/null +++ b/core/migrations/0003_auto_20191206_1600.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.8 on 2019-12-06 09:00 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_auto_20191206_1557'), + ] + + operations = [ + migrations.AlterField( + model_name='student', + name='region', + field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^[A-Za-z]+$')]), + ), + ] diff --git a/core/models/accounts.py b/core/models/accounts.py index f574c698c84d89a9e93546e875a81a70839656ab..66dde10228293b49737701bf292e8981b52034b5 100755 --- a/core/models/accounts.py +++ b/core/models/accounts.py @@ -101,7 +101,7 @@ class Student(models.Model): hackerrank_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) + region = models.CharField(max_length=30, blank=True, null=True, validators=[RegexValidator(r'^[A-Za-z]+$')]) alamat = models.CharField(max_length=50, blank=True, null=True) skills = models.CharField(max_length=50, blank=True, null=True) recommendations = models.ManyToManyField('core.Recommendation', related_name="recommendations", blank=True) diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py index 4f7f282c76860fddd693331ab2c02244ce4106c4..e68a9c341f5b34a5c58d89e50e398a0fb902ce44 100755 --- a/core/tests/test_accounts.py +++ b/core/tests/test_accounts.py @@ -228,6 +228,11 @@ class ProfileUpdateTests(APITestCase): self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) self.assertEqual(response.data.get('region'), 'Indonesia') + response = self.client.patch(url, {'region': '12345'}, format='multipart') + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + + + url = '/api/students/' + str(student_id) + "/profile/" response = self.client.patch(url, {'gender': 'Perempuan'}, format='multipart') self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) @@ -487,9 +492,11 @@ class ProfileUpdateTests(APITestCase): Company.objects.create(user=new_user, description="lalalala", status=Company.VERIFIED, logo=None, address=None) url = '/api/login/' + response = self.client.post(url, {'username': 'dummy.login.company', 'password': 'lalala123', 'login-type': 'company'}, format='json') + company_id = response.data.get('company').get('id') url = '/api/companies/' + str(company_id) + "/profile/" diff --git a/provision/.DS_Store b/provision/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..61d1f2da3985a90f5832911c6e4158fa5e0cfcb3 Binary files /dev/null and b/provision/.DS_Store differ diff --git a/provision/nginx/.DS_Store b/provision/nginx/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d5d5bf94962214228bf6af09b5185b6d6d050d02 Binary files /dev/null and b/provision/nginx/.DS_Store differ