meal_homework/mealapi/model/meal.py

16 lines
629 B
Python
Raw Normal View History

2022-02-13 20:38:02 +01:00
#!/usr/bin/env python3
from .db import db
class Meal(db.Model):
__tablename__ = 'Meal'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
description = db.Column(db.Text, nullable=False)
kcal = db.Column(db.Integer, nullable=True)
price = db.Column(db.Integer, nullable=True)
2022-02-13 21:25:37 +01:00
spicy = db.Column(db.Boolean, nullable=True, default=False)
vegan = db.Column(db.Boolean, nullable=True, default=False)
glutenfree = db.Column(db.Boolean, nullable=True, default=False)
2022-02-13 21:30:13 +01:00
ingredients = db.relationship('Ingredient', back_populates='Meal', lazy='dynamic')