Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Rex Dri
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rex Dri
Rex Dri
Commits
aa616a2a
Commit
aa616a2a
authored
Sep 11, 2018
by
Florent Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected usefull => useful
and return model
parent
7768f71e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
82 additions
and
11 deletions
+82
-11
backend/migrations/0009_auto_20180911_1622.py
backend/migrations/0009_auto_20180911_1622.py
+68
-0
backend/models/abstract/basic_module/basicModule.py
backend/models/abstract/basic_module/basicModule.py
+3
-3
backend/models/abstract/my_model/myModelSerializer.py
backend/models/abstract/my_model/myModelSerializer.py
+1
-1
backend/models/user/previousDeparture.py
backend/models/user/previousDeparture.py
+1
-1
backend/tests/test_moderation.py
backend/tests/test_moderation.py
+1
-1
backend/tests/test_scholarhip_validate.py
backend/tests/test_scholarhip_validate.py
+1
-1
backend/tests/test_semester_dates_validate.py
backend/tests/test_semester_dates_validate.py
+1
-1
backend/utils/__get_model_config.py
backend/utils/__get_model_config.py
+4
-1
backend/validators/tag/tagged_item_validation.py
backend/validators/tag/tagged_item_validation.py
+1
-1
backend/validators/tag/tags_config/__init__.py
backend/validators/tag/tags_config/__init__.py
+1
-1
backend/validators/tag/tags_config/useful_links.py
backend/validators/tag/tags_config/useful_links.py
+0
-0
No files found.
backend/migrations/0009_auto_20180911_1622.py
0 → 100644
View file @
aa616a2a
# Generated by Django 2.0.3 on 2018-09-11 14:22
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0008_auto_20180911_1147'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'campus'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'campustaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'citytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countrydri'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countryscholarship'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countrytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitydri'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universityinfo'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universityscholarship'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitysemestersdates'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
]
backend/models/abstract/basic_module/basicModule.py
View file @
aa616a2a
...
...
@@ -14,7 +14,7 @@ IMPORTANCE_LEVEL = (
class
BasicModule
(
MyModelVersionned
):
comment
=
models
.
TextField
(
blank
=
True
,
default
=
""
)
useful
l
_links
=
JSONField
(
default
=
list
)
useful_links
=
JSONField
(
default
=
list
)
importance_level
=
models
.
CharField
(
max_length
=
2
,
choices
=
IMPORTANCE_LEVEL
,
...
...
@@ -28,8 +28,8 @@ class BasicModule(MyModelVersionned):
class
BasicModuleSerializer
(
MyModelVersionnedSerializer
):
def
my_validate
(
self
,
attrs
):
content
=
{
'useful
l_links'
:
attrs
[
'useful
l_links'
]}
config
=
{
'useful
l
_links'
:
USEFULL_LINKS_CONFIG
}
content
=
{
'useful
_links'
:
attrs
[
'usefu
l_links'
]}
config
=
{
'useful_links'
:
USEFULL_LINKS_CONFIG
}
validate_content_against_config
(
config
,
content
)
return
attrs
...
...
backend/models/abstract/my_model/myModelSerializer.py
View file @
aa616a2a
...
...
@@ -34,7 +34,7 @@ class MyModelSerializer(MySerializerWithJSON):
model_config
=
serializers
.
SerializerMethodField
()
# For easier handling on the client side, we force an id field
# this is useful
l
when a model has a dedicated primary key
# this is useful when a model has a dedicated primary key
id
=
serializers
.
SerializerMethodField
()
def
get_model_config
(
self
,
obj
=
None
):
...
...
backend/models/user/previousDeparture.py
View file @
aa616a2a
...
...
@@ -15,7 +15,7 @@ class PreviousDeparture(MyModel):
university
=
models
.
ForeignKey
(
University
,
on_delete
=
models
.
PROTECT
)
specialty
=
models
.
ForeignKey
(
Specialty
,
on_delete
=
models
.
PROTECT
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
# Useful
l
to relink a departure with a user
# Useful to relink a departure with a user
Utc_departure_id
=
models
.
IntegerField
()
is_anonymous
=
models
.
BooleanField
()
...
...
backend/tests/test_moderation.py
View file @
aa616a2a
...
...
@@ -221,7 +221,7 @@ class ModerationTestCase(WithUserTestCase):
data
=
{
"comment"
:
""
,
"useful
l
_links"
:
[],
"useful_links"
:
[],
"universities"
:
[
c
.
pk
]
}
api_end_point
=
"/api/"
+
\
...
...
backend/tests/test_scholarhip_validate.py
View file @
aa616a2a
...
...
@@ -9,7 +9,7 @@ class ScholarshipTestCase(TestCase):
def
test_scholarhip_validation
(
self
):
ser
=
ScholarshipSerializer
()
attrs
=
{
'useful
l
_links'
:
[],
'useful_links'
:
[],
'comment'
:
''
}
with
pytest
.
raises
(
ValidationError
):
...
...
backend/tests/test_semester_dates_validate.py
View file @
aa616a2a
...
...
@@ -13,7 +13,7 @@ class SemesterDatesTestCase(TestCase):
def
build
(
l
):
tmp
=
{
sem
:
val
for
sem
,
val
in
zip
(
semesters
,
l
)}
tmp
[
'comment'
]
=
""
tmp
[
'useful
l
_links'
]
=
[]
tmp
[
'useful_links'
]
=
[]
return
tmp
def
_test_attrs_error
(
attrs
):
...
...
backend/utils/__get_model_config.py
View file @
aa616a2a
...
...
@@ -6,6 +6,9 @@ def get_model_config(model):
for
obj
in
api_config
:
if
obj
[
'model'
]
==
model
:
return
{
"moderation_level"
:
obj
[
"moderation_level"
]}
return
{
"moderation_level"
:
obj
[
"moderation_level"
],
"model"
:
model
}
raise
Exception
(
"Model not found in API configuraiton, cannot process !"
)
backend/validators/tag/tagged_item_validation.py
View file @
aa616a2a
...
...
@@ -36,7 +36,7 @@ def validate_content_against_config(config, content):
elif
field_type
==
'photos'
:
validate_content_against_config
({
"photos"
:
PHOTOS_TAG_CONFIG
},
{
"photos"
:
field_submitted
})
elif
field_type
==
'useful
l
_links'
:
elif
field_type
==
'useful_links'
:
validate_content_against_config
({
"ul"
:
USEFULL_LINKS_CONFIG
},
{
"ul"
:
field_submitted
})
elif
field_type
==
'array'
:
...
...
backend/validators/tag/tags_config/__init__.py
View file @
aa616a2a
from
.photos
import
PHOTOS_TAG_CONFIG
# noqa: F401
from
.useful
l
_links
import
USEFULL_LINKS_CONFIG
# noqa: F401
from
.useful_links
import
USEFULL_LINKS_CONFIG
# noqa: F401
backend/validators/tag/tags_config/useful
l
_links.py
→
backend/validators/tag/tags_config/useful_links.py
View file @
aa616a2a
File moved
Write
Preview
Markdown
is supported
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