Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
058edc5a
Commit
058edc5a
authored
Nov 15, 2019
by
Aldo Bima Syahputra
Browse files
Merge branch '1606833463-135' into 'master'
1606833463 135 See merge request
!164
parents
2475179b
05492ca4
Pipeline
#25167
passed with stages
in 11 minutes and 21 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
core/lib/validators.py
View file @
058edc5a
...
...
@@ -20,6 +20,9 @@ def validate_document_file_extension(value):
def
validate_image_file_extension
(
value
):
validate_file
(
value
,
[
'.jpeg'
,
'.jpg'
,
'.png'
,
'.JPG'
,
'.JPEG'
])
def
validate_student_gpa
(
value
):
if
(
value
<
0
or
value
>
4
):
raise
ValidationError
(
u
"GPA harus merupakan angka antara 0-4"
)
def
validate_npm
(
value
):
'''
...
...
core/migrations/0002_auto_20191114_1728.py
0 → 100644
View file @
058edc5a
# -*- 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
),
),
]
core/migrations/0005_merge_20191115_1314.py
0 → 100644
View file @
058edc5a
# -*- 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
=
[
]
core/migrations/0006_auto_20191115_1409.py
0 → 100644
View file @
058edc5a
# -*- 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
]),
),
]
core/models/accounts.py
View file @
058edc5a
...
...
@@ -7,7 +7,7 @@ from django.contrib.auth.models import User
from
django.core.validators
import
MinValueValidator
,
MaxValueValidator
,
RegexValidator
,
FileExtensionValidator
from
django.db
import
models
from
core.lib.validators
import
validate_document_file_extension
,
validate_image_file_extension
,
validate_npm
from
core.lib.validators
import
validate_document_file_extension
,
validate_image_file_extension
,
validate_npm
,
validate_student_gpa
def
get_student_resume_file_path
(
instance
,
filename
):
...
...
@@ -99,7 +99,7 @@ class Student(models.Model):
intro
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
,
null
=
True
)
expected_salary
=
models
.
CharField
(
max_length
=
10
,
blank
=
True
,
null
=
True
)
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
)
student_gpa
=
models
.
FloatField
(
db_column
=
'student_gpa'
,
default
=
1.0
,
blank
=
True
,
null
=
True
,
validators
=
[
validate_student_gpa
]
)
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
)
...
...
core/tests/test_accounts.py
View file @
058edc5a
...
...
@@ -238,6 +238,13 @@ class ProfileUpdateTests(APITestCase):
self
.
assertEqual
(
response
.
data
.
get
(
'seminar'
),
'Seminar CompFest'
)
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
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'student_gpa'
:
'8'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
response
=
self
.
client
.
patch
(
url
,
{
'interests'
:
'Machine Learning'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'interests'
),
'Machine Learning'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment