Fixed stuff
All checks were successful
continuous-integration/drone/push Build is passing

- Creating a new new object when it isn't supposed
- Serializing enum field
This commit is contained in:
2020-09-14 03:02:31 +02:00
parent bfe2ec8c8c
commit 7a9d098107
2 changed files with 4 additions and 3 deletions

View File

@ -1,13 +1,16 @@
#!/usr/bin/env python3
from marshmallow import fields
from marshmallow_sqlalchemy import ModelSchema
from model import AIModel
from marshmallow_enum import EnumField
from model import AIModel, AIModelType
class AIModelSchema(ModelSchema):
default = fields.Method("boolize_default", dump_only=True)
type = EnumField(AIModelType)
def boolize_default(self, ai_model) -> bool:
return bool(ai_model.default)