Пример #1
0
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 !
Пример #2
0
 class MySchema(Schema):
     a = fields.AwareDateTimeField()
     b = fields.AwareDateTimeField(default_timezone=timezone_2h)