From c0918e7b576d3aa694c6e041390b54d5661d1abd Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 2 Feb 2022 14:17:42 +0100 Subject: [PATCH] fix error message in form --- ereuse_devicehub/inventory/views.py | 3 ++- ereuse_devicehub/templates/inventory/allocate.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index ea17d25f..0b3446c1 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -297,13 +297,14 @@ class NewAllocateView(NewActionView, DeviceListMix): def dispatch_request(self): dispatch = super().dispatch_request() - if dispatch.status_code == 302: + if dispatch: return dispatch # lot_id = self.form.lot.data # FIXME # import pdb; pdb.set_trace() self.get_context(None) + self.context['form_new_allocate'] = self.form return flask.render_template(self.template_name, **self.context) diff --git a/ereuse_devicehub/templates/inventory/allocate.html b/ereuse_devicehub/templates/inventory/allocate.html index 7b53744c..9c58f88b 100644 --- a/ereuse_devicehub/templates/inventory/allocate.html +++ b/ereuse_devicehub/templates/inventory/allocate.html @@ -25,7 +25,7 @@ {{ field.label(class_="form-label") }} {{ field(class_="form-control") }} {% if field.errors %} -

+

{% for error in field.errors %} {{ error }}
{% endfor %}