示例#1
0
class Feed(Document):
    type = fields.StringField(required=True)
    uri = fields.StringField()
    name = fields.StringField(required=True)
    last_ts = fields.NumberField(required=True, default=0)

    class Meta:
        collection_name = "feed"
示例#2
0
文件: db.py 项目: recluse27/delivery
class Product(Document):
    category = fields.ReferenceField(Category)
    name = fields.StringField(required=True, unique=True)
    description = fields.StringField(required=True, unique=True)
    price = fields.NumberField(required=True)
    image_url = fields.UrlField()
    available_from = fields.DateTimeField()
    available_till = fields.DateTimeField()
示例#3
0
 class MySchema(Schema):
     string = fields.StringField()
     uuid = fields.UUIDField()
     number = fields.NumberField()
     integer = fields.IntegerField()
     decimal = fields.DecimalField()
     boolean = fields.BooleanField()
     float = fields.FloatField()
     url = fields.UrlField()
     email = fields.EmailField()
     constant = fields.ConstantField("const")
示例#4
0
class Product(Document):
    # id_prod = fields.IntegerField()
    id_cat = fields.ReferenceField(Category)
    name_prod = fields.StringField(required=True, unique=True)
    description = fields.StringField(required=True, unique=True)
    price = fields.NumberField(required=True)
    image_url_prod = fields.UrlField()
    avail_from = fields.DateTimeField()
    avail_till = fields.DateTimeField()

    class Meta:
        collection = db.product
示例#5
0
 class MySchema(EmbeddedSchema):
     string = fields.StringField()
     uuid = fields.UUIDField()
     number = fields.NumberField()
     integer = fields.IntegerField()
     decimal = fields.DecimalField()
     boolean = fields.BooleanField()
     formattedstring = fields.FormattedStringField('Hello {to_format}')
     float = fields.FloatField()
     # localdatetime = fields.LocalDateTimeField()
     url = fields.UrlField()
     email = fields.EmailField()
     constant = fields.ConstantField("const")
示例#6
0
class Article(Document):
    ts = fields.NumberField(required=True, default=0)
    text = fields.StringField()
    tags = fields.ListField(fields.StringField(), default=[])
    source = fields.ReferenceField("Feed")
    address = fields.StringField(default="")
    # Location: {
    #       type: "Point",
    #       coordinates: [-73.856077, 40.848447]
    # }
    location = fields.DictField(default={})

    class Meta:
        collection_name = "article"