Commit dc5c864c authored by Willard's avatar Willard

Fix dish_views wrong URL and no placeholders

parent 3ce6b7d8
...@@ -24,7 +24,7 @@ class NewDishView(FormView): ...@@ -24,7 +24,7 @@ class NewDishView(FormView):
db.session.commit() db.session.commit()
return redirect(url_for('view_stall', stall_id=self.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('dishinfo.html', form=self.get_form(), stall=self.stall, title='New Dish', form_action=url_for('stalls', stall_id=stall_id), submit_label='Add') return render_template('dishinfo.html', form=self.get_form(), stall=self.stall, title='New Dish', form_action=url_for('new_dish', stall_id=self.stall.id), submit_label='Add')
def get_form(self): def get_form(self):
form = DishRegisterForm() form = DishRegisterForm()
form.dish_type.choices = [(dish_type.id, dish_type.name) for dish_type in DishType.query.all()] form.dish_type.choices = [(dish_type.id, dish_type.name) for dish_type in DishType.query.all()]
......
...@@ -64,10 +64,10 @@ class StallRegisterForm(FlaskForm): ...@@ -64,10 +64,10 @@ class StallRegisterForm(FlaskForm):
return True return True
class DishRegisterForm(FlaskForm): class DishRegisterForm(FlaskForm):
name = StringField('Name', [DataRequired()]) name = StringField('Name', [DataRequired()], render_kw={"placeholder": "Name"})
description = TextAreaField('Description', [DataRequired()]) description = TextAreaField('Description', [DataRequired()], render_kw={"placeholder": "Describe your dish"})
image = FileField('Image') image = FileField('Image')
price = DecimalField('Price', [DataRequired()]) price = DecimalField('Price', [DataRequired()], render_kw={"placeholder": "Price"})
dish_type = SelectField('Type', coerce=int) dish_type = SelectField('Type', coerce=int)
def validate(self, editing=False): def validate(self, editing=False):
......
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