Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
c776e24f
Commit
c776e24f
authored
Sep 09, 2018
by
Florent Chehab
Browse files
Bug corrected and importance level added
parent
9c099cdf
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/migrations/0002_auto_20180909_1455.py
0 → 100644
View file @
c776e24f
# Generated by Django 2.0.3 on 2018-09-09 12:55
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'campus'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'countrydri'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'countryscholarship'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'universitydri'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'universityinfo'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'universityscholarship'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
migrations
.
AddField
(
model_name
=
'universitysemestersdates'
,
name
=
'importance_level'
,
field
=
models
.
CharField
(
choices
=
[(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)],
default
=
'-'
,
max_length
=
2
),
),
]
backend/models/module/basicModule.py
View file @
c776e24f
...
...
@@ -4,11 +4,22 @@ from backend.models.tools import JSONField
from
backend.models.tag.tagged_item_validation
import
validate_content_against_config
from
backend.models.tag.tags_config
import
USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL
=
(
(
'-'
,
'normal'
),
(
'+'
,
'important'
),
(
'++'
,
'IMPORTANT'
)
)
class
BasicModule
(
MyModelVersionned
):
comment
=
models
.
TextField
(
blank
=
True
)
usefull_links
=
JSONField
(
default
=
list
)
importance_level
=
models
.
CharField
(
max_length
=
2
,
choices
=
IMPORTANCE_LEVEL
,
default
=
'-'
,
)
class
Meta
:
abstract
=
True
...
...
backend/models/module/scholarship.py
View file @
c776e24f
...
...
@@ -28,6 +28,7 @@ class Scholarship(BasicModule):
class
ScholarshipSerializer
(
BasicModuleSerializer
):
def
my_validate
(
self
,
attrs
):
attrs
=
super
(
ScholarshipSerializer
,
self
).
my_validate
(
attrs
)
if
attrs
[
'amount_max'
]
<
attrs
[
'amount_min'
]:
raise
serializers
.
ValidationError
(
"Amount_max should be greater or equal than amount_min"
)
...
...
backend/models/university/universitySemestersDates.py
View file @
c776e24f
...
...
@@ -29,6 +29,8 @@ class UniversitySemestersDates(BasicModule):
class
UniversitySemestersDatesSerializer
(
BasicModuleSerializer
):
def
my_validate
(
self
,
attrs
):
attrs
=
super
(
UniversitySemestersDatesSerializer
,
self
).
my_validate
(
attrs
)
s_b
,
s_e
=
attrs
[
'spring_begin'
],
attrs
[
'spring_end'
]
a_b
,
a_e
=
attrs
[
'autumn_begin'
],
attrs
[
'autumn_end'
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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