示例#1
0
class Test(JsonObject):
    id = fields.Int()
    name = fields.Str()
    quantity = fields.Float()
    email = fields.Email()
    date = fields.DateTime(
        format='%Y-%m-%d %H:%M',
        missing=lambda: datetime.now().strftime('%Y-%m-%d %H:%M'))

    class Meta:
        ordered = True
示例#2
0
文件: model.py 项目: zeteref/eatwatch
class Ingredient(JsonObject):
    id = fields.Int()
    name = fields.Str()
    calories = fields.Float()
    sugar = fields.Float()
    veg_protein = fields.Float()
    protein = fields.Float()
    carbo = fields.Float()
    fats = fields.Float()

    class Meta:
        ordered = True


    def columns():
        return Ingredient.fields()
示例#3
0
文件: model.py 项目: zeteref/eatwatch
class Meal(JsonObject):
    id = fields.Int()
    name = fields.Str()
    date = fields.DateTime(
            format='%Y-%m-%d %H:%M', 
            default=lambda: datetime.now().strftime('%Y-%m-%d %H:%M'))

    meal_ingredients = fields.List(fields.Nested(MealIngredient), missing=[])


    class Meta:
        ordered = True


    def columns():
        return [x for x in Meal.fields() 
            if x not in ('meal_ingredients',)]
示例#4
0
class ParamsHolder(JsonObject):
    params = fields.List(fields.Str(), missing=[])
示例#5
0
class Due(JsonObject):
    id = fields.Int()
    name = fields.Str()
    unos = fields.List(fields.Nested(Uno))
示例#6
0
class Uno(JsonObject):
    name = fields.Str()
    date = fields.DateTime(format='%Y-%m-%d %H:%M')