Properly display form errors in counter

This commit is contained in:
2024-12-20 20:18:02 +01:00
parent f9d7dc7d3a
commit 5f0b4d2050
3 changed files with 19 additions and 5 deletions

View File

@ -261,6 +261,11 @@ class CounterClick(CounterTabsMixin, CanViewMixin, SingleObjectMixin, FormView):
)
kwargs["customer"] = self.customer
# To get all forms errors to the javascript, we create a list of error list
kwargs["form_errors"] = []
for field_errors in kwargs["form"].errors:
kwargs["form_errors"].append(list(field_errors.values()))
if self.object.type == "BAR":
kwargs["student_card_fragment"] = StudentCardFormView.get_template_data(
self.customer