Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine-api
Commits
b6b487ba
Commit
b6b487ba
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Avoid rendering of None values in JSON.
parent
560c784c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/models.py
+13
-4
13 additions, 4 deletions
src/models.py
with
13 additions
and
4 deletions
src/models.py
+
13
−
4
View file @
b6b487ba
...
@@ -20,10 +20,11 @@
...
@@ -20,10 +20,11 @@
import
datetime
import
datetime
from
sqlalchemy
import
create_engine
,
Column
,
DateTime
,
String
,
Integer
,
Boolean
from
sqlalchemy
import
create_engine
,
Column
,
DateTime
,
String
,
Integer
,
Boolean
from
sqlalchemy.event
import
listen
from
sqlalchemy.event
import
listen
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_marshmallow
import
Marshmallow
from
flask_marshmallow
import
Marshmallow
from
marshmallow
import
Schema
,
fields
,
post_dump
db
=
SQLAlchemy
()
db
=
SQLAlchemy
()
ma
=
Marshmallow
()
ma
=
Marshmallow
()
...
@@ -163,6 +164,14 @@ class PlayLogSchema(ma.SQLAlchemyAutoSchema):
...
@@ -163,6 +164,14 @@ class PlayLogSchema(ma.SQLAlchemyAutoSchema):
model
=
PlayLog
model
=
PlayLog
sqla_session
=
db
.
session
sqla_session
=
db
.
session
SKIP_VALUES
=
set
([
None
])
@post_dump
def
remove_skip_values
(
self
,
data
,
many
=
False
):
return
{
key
:
value
for
key
,
value
in
data
.
items
()
if
value
not
in
self
.
SKIP_VALUES
}
class
TrackSchema
(
ma
.
SQLAlchemySchema
):
class
TrackSchema
(
ma
.
SQLAlchemySchema
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment