Fix bug in ordering

This commit is contained in:
Midgard 2020-02-27 11:21:16 +01:00
parent cb8d640502
commit bba3a0cd3a
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -150,7 +150,10 @@ def order_item_create(order_id: int) -> typing.Any:
all_choices_present = all(x is not None for x in chosen) all_choices_present = all(x is not None for x in chosen)
if dish_was_changed or not all_choices_present: if dish_was_changed or not all_choices_present:
try:
user_name = form.user_name.data if form.user_name.validate(form) else None user_name = form.user_name.data if form.user_name.validate(form) else None
except AttributeError:
user_name = None
comment = form.comment.data if form.comment.validate(form) else None comment = form.comment.data if form.comment.validate(form) else None
return redirect(url_for("order_bp.order_item_create", return redirect(url_for("order_bp.order_item_create",