Commit b8f94fa9 authored by Willard's avatar Willard

Pass stall id instead of stall object to Dish constuctor

parent 29f85a36
......@@ -135,7 +135,7 @@ def new_dish(stall_id):
if request.method == 'POST':
if form.validate():
filename = secure_filename(form.image.data.filename)
dish = Dish(form.name.data, form.description.data, form.price.data, stall, filename)
dish = Dish(form.name.data, form.description.data, form.price.data, stall.id, filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
db.session.add(dish)
db.session.commit()
......
......@@ -38,11 +38,11 @@ class Dish(db.Model):
favorites = db.relationship('User', secondary=dish_favorites, backref=db.backref('dish', lazy='dynamic'))
reviews = db.relationship('DishReview', backref='dish', lazy='dynamic')
def __init__(self, name, description, price, stall, image_path):
def __init__(self, name, description, price, stall_id, image_path):
self.name = name
self.description = description
self.price = price
self.stall_id = stall.id
self.stall_id = stall_id
self.image_path = image_path
class Owner(db.Model):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment