From bba3a0cd3aa925c233743693b8f47ee214d0c3f5 Mon Sep 17 00:00:00 2001 From: Midgard Date: Thu, 27 Feb 2020 11:21:16 +0100 Subject: [PATCH] Fix bug in ordering --- app/views/order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/order.py b/app/views/order.py index faa2778..8b407cf 100644 --- a/app/views/order.py +++ b/app/views/order.py @@ -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) if dish_was_changed or not all_choices_present: - user_name = form.user_name.data if form.user_name.validate(form) else None + try: + 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 return redirect(url_for("order_bp.order_item_create",