Exemple #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
Exemple #2
0
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()
Exemple #3
0
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',)]
Exemple #4
0
class ParamsHolder(JsonObject):
    params = fields.List(fields.Str(), missing=[])
Exemple #5
0
class Due(JsonObject):
    id = fields.Int()
    name = fields.Str()
    unos = fields.List(fields.Nested(Uno))
Exemple #6
0
class Uno(JsonObject):
    name = fields.Str()
    date = fields.DateTime(format='%Y-%m-%d %H:%M')