Exemplo n.º 1
0
 class WithDefault(Document):
     with_umongo_default = fields.StrictDateTimeField(
         default=datetime(1999, 1, 1))
     with_marshmallow_missing = fields.StrictDateTimeField(
         marshmallow_missing='2000-01-01T00:00:00+00:00')
     with_marshmallow_default = fields.StrictDateTimeField(
         marshmallow_default='2001-01-01T00:00:00+00:00')
     with_marshmallow_and_umongo = fields.StrictDateTimeField(
         default=datetime(1999, 1, 1),
         marshmallow_missing='2000-01-01T00:00:00+00:00',
         marshmallow_default='2001-01-01T00:00:00+00:00')
     with_force_missing = fields.StrictDateTimeField(
         default=datetime(2001, 1, 1),
         marshmallow_missing=missing,
         marshmallow_default=missing)
     with_nothing = fields.StrField()
Exemplo n.º 2
0
class Context(Document):
    """
    :ivar User ofUser:
    :ivar datetime timestamp:
    :ivar typing.List[Params] params:
    :ivar Message message:
    """
    ofUser = fields.ReferenceField(User, dbRef=True, required=True)
    timestamp = fields.StrictDateTimeField(tz_aware=True,
                                           format="iso",
                                           required=True)
    params = fields.ListField(fields.EmbeddedField(Params))
    message = fields.EmbeddedField(Message)
Exemplo n.º 3
0
class Params(EmbeddedDocument):
    """
    :ivar Topic ofTopic:
    :ivar Dict values:
    :ivar datetime startTime:
    :ivar int priority:
    """

    ofTopic = fields.ReferenceField(Topic, dbRef=True, required=True)
    values = fields.DictField(required=False)
    startTime = fields.StrictDateTimeField(tz_aware=True,
                                           format="iso",
                                           required=True)
    priority = fields.IntegerField(required=True)
Exemplo n.º 4
0
 class MySchema(EmbeddedSchema):
     a = fields.StrictDateTimeField()
     b = fields.StrictDateTimeField(load_as_tz_aware=False)
     c = fields.StrictDateTimeField(load_as_tz_aware=True)