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):
db.session.commit()
return redirect(url_for('view_stall', stall_id=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):
form = DishRegisterForm()
form.dish_type.choices = [(dish_type.id, dish_type.name) for dish_type in DishType.query.all()]
......
......@@ -64,10 +64,10 @@ class StallRegisterForm(FlaskForm):
return True
class DishRegisterForm(FlaskForm):
name = StringField('Name', [DataRequired()])
description = TextAreaField('Description', [DataRequired()])
name = StringField('Name', [DataRequired()], render_kw={"placeholder": "Name"})
description = TextAreaField('Description', [DataRequired()], render_kw={"placeholder": "Describe your dish"})
image = FileField('Image')
price = DecimalField('Price', [DataRequired()])
price = DecimalField('Price', [DataRequired()], render_kw={"placeholder": "Price"})
dish_type = SelectField('Type', coerce=int)
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