meal_homework/mealapi/model/ingredient.py

11 lines
362 B
Python
Raw Normal View History

2022-02-13 20:38:02 +01:00
#!/usr/bin/env python3
from .db import db
class Ingredient(db.Model):
__tablename__ = 'Ingredient'
id = db.Column(db.Integer, primary_key=True)
2022-02-13 21:10:02 +01:00
name = db.Column(db.String(255), nullable=False, unique=True)
2022-02-13 21:06:52 +01:00
meal_id = db.Column(db.Integer, db.ForeignKey('Meal.id'))
2022-02-13 21:31:37 +01:00
meal = db.relationship('Meal', back_populates='Ingredient', lazy='dynamic')