Commit 423d015e authored by Willard's avatar Willard

Fix wrong number of arguments for overriding dispatch_request

parent 33d2eb77
...@@ -14,7 +14,7 @@ class NewDishView(FormView): ...@@ -14,7 +14,7 @@ class NewDishView(FormView):
decorators = [login_required, stall_validate] decorators = [login_required, stall_validate]
def dispatch_request(self, stall_id): def dispatch_request(self, stall_id):
self.stall = Stall.query.get(stall_id) self.stall = Stall.query.get(stall_id)
return FormView.dispatch_request(self, stall_id) return FormView.dispatch_request(self, stall_id=stall_id)
def render_post(self, stall_id): def render_post(self, stall_id):
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)
...@@ -37,7 +37,7 @@ class EditDishView(FormView): ...@@ -37,7 +37,7 @@ class EditDishView(FormView):
def dispatch_request(self, stall_id, dish_id): def dispatch_request(self, stall_id, dish_id):
self.stall = Stall.query.get(stall_id) self.stall = Stall.query.get(stall_id)
self.dish = Dish.query.get(dish_id) self.dish = Dish.query.get(dish_id)
return FormView.dispatch_request(self, stall_id, dish_id) return FormView.dispatch_request(self, stall_id=stall_id, dish_id=dish_id)
def render_post(self, stall_id, dish_id): def render_post(self, stall_id, dish_id):
self.dish.name = form.name.data self.dish.name = form.name.data
self.dish.description = form.description.data self.dish.description = form.description.data
......
...@@ -38,7 +38,7 @@ class EditStallView(FormView): ...@@ -38,7 +38,7 @@ class EditStallView(FormView):
decorators = [login_required, stall_validate] decorators = [login_required, stall_validate]
def dispatch_request(self, stall_id): def dispatch_request(self, stall_id):
self.stall = Stall.query.get(stall_id) self.stall = Stall.query.get(stall_id)
return FormView.dispatch_request(self, 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() form = self.get_form()
self.stall.name = form.name.data self.stall.name = form.name.data
......
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