Fix dish change detection once and for all
This commit is contained in:
parent
8aa50d1bd9
commit
172d5d1e08
2 changed files with 3 additions and 3 deletions
|
@ -53,8 +53,8 @@
|
||||||
{{ util.render_form_field_errors(form.dish_id) }}
|
{{ util.render_form_field_errors(form.dish_id) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if dish and dish.choices %}
|
|
||||||
<input type="hidden" name="form_for_dish" value="{{ dish.id }}" />
|
<input type="hidden" name="form_for_dish" value="{{ dish.id }}" />
|
||||||
|
{% if dish and dish.choices %}
|
||||||
{% for (choice_type, choice) in dish.choices %}
|
{% for (choice_type, choice) in dish.choices %}
|
||||||
<div class="form-group select2-container select2">
|
<div class="form-group select2-container select2">
|
||||||
<label class="control-label" for="choice_{{ choice.id }}">{{ choice.name }}</label><br/>
|
<label class="control-label" for="choice_{{ choice.id }}">{{ choice.name }}</label><br/>
|
||||||
|
|
|
@ -134,8 +134,8 @@ def order_item_create(order_id: int) -> typing.Any:
|
||||||
form.populate(current_order.location)
|
form.populate(current_order.location)
|
||||||
|
|
||||||
if form.is_submitted():
|
if form.is_submitted():
|
||||||
form_for_dish = request.form.get("form_for_dish_id")
|
form_for_dish = request.form["form_for_dish"]
|
||||||
dish_was_changed = form_for_dish is not None and form_for_dish != dish_id
|
dish_was_changed = form_for_dish != "" and form_for_dish != dish_id
|
||||||
|
|
||||||
# The form's validation tests that dish_id is valid and gives a friendly error if it's not
|
# The form's validation tests that dish_id is valid and gives a friendly error if it's not
|
||||||
choices = location.dish_by_id(form.dish_id.data).choices
|
choices = location.dish_by_id(form.dish_id.data).choices
|
||||||
|
|
Loading…
Reference in a new issue