model-service/model_service/schemas/aimodel_schema.py
2020-04-14 17:26:33 +02:00

16 lines
356 B
Python

#!/usr/bin/env python3
from marshmallow import fields
from marshmallow_sqlalchemy import ModelSchema
from model import AIModel
class AIModelSchema(ModelSchema):
default = fields.Method("boolize_default", dump_only=True)
def boolize_default(self, ai_model) -> bool:
return bool(ai_model.default)
class Meta:
model = AIModel