Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Restriction(db.Model):
- __tablename__ = "restriction"
- id = db.Column(db.Integer, primary_key=True)
- title= db.Column(db.String, nullable= False)
- description = db.Column(db.String, nullable=False)
- recipes= db.relationship('Recipe', secondary= restiction_association_table, back_populates = 'restrictions')
- def __init__(self, **kwargs):
- self.title=kwargs.get("title")
- self.description=kwargs.get("description")
- def serialize(self):
- return {
- 'id': self.id,
- 'title': self.title,
- 'description': self.description,
- 'recipes': [r.serialize() for r in self.recipes]
- }
- def simple_serialize(self):
- return{
- 'id': self.id,
- 'title': self.title,
- 'description': self.description
- }
Advertisement
Add Comment
Please, Sign In to add comment