Commit 25e5399e authored by Willard's avatar Willard

Fix more syntax errors

parent 30ea4d5c
...@@ -16,12 +16,13 @@ class NewDishView(FormView): ...@@ -16,12 +16,13 @@ class NewDishView(FormView):
self.stall = Stall.query.get(stall_id) self.stall = Stall.query.get(stall_id)
return FormView.dispatch_request(self, stall_id=stall_id) return FormView.dispatch_request(self, stall_id=stall_id)
def render_post(self, stall_id): def render_post(self, stall_id):
form = self.get_form()
filename = secure_filename(form.image.data.filename) filename = secure_filename(form.image.data.filename)
dish = Dish(form.name.data, form.description.data, form.price.data, self.stall.id, filename) dish = Dish(form.name.data, form.description.data, form.price.data, self.stall.id, filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
db.session.add(dish) db.session.add(dish)
db.session.commit() db.session.commit()
return redirect(url_for('view_stall', stall_id=stall.id)) return redirect(url_for('view_stall', stall_id=self.stall.id))
def render_get(self, stall_id): def render_get(self, stall_id):
return render_template('newdish.html', form=self.get_form(), stall=self.stall) return render_template('newdish.html', form=self.get_form(), stall=self.stall)
def get_form(self): def get_form(self):
......
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