예제 #1
0
class Scion(Car):
    any_owner = field.DynamicDocument()
    color = field.Choice(choices=["Red", "Blue", "Green"])
    make = field.Char(default="Scion")
    model = field.Char(default="xA")
    year = field.Date(default=datetime.datetime(2007, 1, 1))
    silly_date = field.TimeStamp()
예제 #2
0
class Human(orm.Document):
    _db = "test"
    _collection = "humans"
    human_id = field.AutoIncrement(collection="human")
    name = field.Char(required=True, min=2, max=25)
    age = field.Integer(required=True, min=0, max=3000)
    height = field.Float(min=1, max=100000)
    weight = field.Float(min=1, max=30000)
    jobs = orm.List(type=Job)
    genitalia = field.Char()
    location = Location()
    car = field.ModelChoice(type=Car)
    color = field.Choice(choices=[{
        'value': 'red',
        'display': 'Red'
    }, {
        'value': 'blue',
        'display': 'Blue'
    }, {
        'value': 'green',
        'display': 'Green'
    }])
    state = field.CollectionChoice(db='test',
                                   collection='states',
                                   sort=[('fullname', 1)])
    email = field.Email()