Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
f5858327
Commit
f5858327
authored
Aug 29, 2018
by
Florent Chehab
Browse files
JSON field better handling
parent
b0079b94
Changes
6
Hide whitespace changes
Inline
Side-by-side
backend/migrations/0025_auto_20180829_2101.py
0 → 100644
View file @
f5858327
# Generated by Django 2.0.3 on 2018-08-29 19:01
import
django.contrib.postgres.fields.jsonb
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0024_auto_20180829_1840'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'pendingmoderation'
,
name
=
'new_object'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AlterField
(
model_name
=
'previousdeparturefeedback'
,
name
=
'courses_and_courses_feedback'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AlterField
(
model_name
=
'userdata'
,
name
=
'config'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AlterField
(
model_name
=
'userdata'
,
name
=
'contact_info'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AlterField
(
model_name
=
'userdata'
,
name
=
'other_data'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
]
backend/models/module/basicModule.py
View file @
f5858327
...
...
@@ -7,7 +7,7 @@ from django.contrib.postgres.fields import JSONField
class
BasicModule
(
MyModelVersionned
):
comment
=
models
.
TextField
(
blank
=
True
)
usefull_links
=
UsefullLinksField
(
blank
=
True
)
usefull_links
=
UsefullLinksField
(
blank
=
True
,
default
=
list
)
custom_content
=
JSONField
(
blank
=
True
,
default
=
dict
)
class
Meta
:
...
...
backend/models/my_model/pendingModeration.py
View file @
f5858327
...
...
@@ -14,7 +14,7 @@ class PendingModeration(models.Model):
updated_by
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
updated_on
=
models
.
DateTimeField
(
null
=
True
)
new_object
=
JSONField
(
default
=
{}
)
new_object
=
JSONField
(
default
=
dict
)
class
Meta
:
unique_together
=
(
'content_type'
,
'object_id'
)
...
...
backend/models/tools/usefullLinksField.py
View file @
f5858327
...
...
@@ -31,5 +31,5 @@ class UsefullLinksField(JSONField):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'validators'
]
=
[
validate_usefull_links
]
kwargs
[
'default'
]
=
[]
kwargs
[
'default'
]
=
list
super
(
UsefullLinksField
,
self
).
__init__
(
*
args
,
**
kwargs
)
backend/models/user/previousDepartureFeedback.py
View file @
f5858327
...
...
@@ -10,7 +10,7 @@ class PreviousDepartureFeedback(UserRestrictedModule):
departure
=
models
.
OneToOneField
(
PreviousDeparture
,
on_delete
=
models
.
CASCADE
)
courses_and_courses_feedback
=
JSONField
(
null
=
True
)
courses_and_courses_feedback
=
JSONField
(
default
=
dict
)
adequation_comment
=
models
.
TextField
()
integration_comment
=
models
.
TextField
()
adequation_grate
=
models
.
PositiveIntegerField
(
...
...
backend/models/user/userData.py
View file @
f5858327
...
...
@@ -9,12 +9,12 @@ from backend.models.tools import NoDelete, IsOwner
class
UserData
(
MyModel
):
owner
=
models
.
OneToOneField
(
User
,
on_delete
=
models
.
CASCADE
)
contact_info
=
JSONField
(
null
=
True
,
default
=
{}
)
contact_info
=
JSONField
(
default
=
dict
)
contact_info_is_public
=
models
.
BooleanField
(
default
=
False
)
config
=
JSONField
(
null
=
True
,
default
=
{}
)
config
=
JSONField
(
default
=
dict
)
black_list
=
models
.
ManyToManyField
(
University
,
related_name
=
'+'
,
blank
=
True
)
other_data
=
JSONField
(
null
=
True
,
default
=
{}
)
other_data
=
JSONField
(
default
=
dict
)
class
UserDataSerializer
(
MyModelSerializer
):
...
...
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