class User(Document): # We specify `RemoveMissingSchema` as a base marshmallow schema so that # auto-generated marshmallow schemas skip missing fields instead of returning None MA_BASE_SCHEMA_CLS = RemoveMissingSchema nick = fields.StrField(required=True, unique=True) firstname = fields.StrField() lastname = fields.StrField() birthday = fields.AwareDateTimeField() password = fields.StrField() # Don't store it in clear in real life !
class MySchema(Schema): a = fields.AwareDateTimeField() b = fields.AwareDateTimeField(default_timezone=timezone_2h)