fix error message in form

This commit is contained in:
Cayo Puigdefabregas 2022-02-02 14:17:42 +01:00
parent 71f5a8a98b
commit c0918e7b57
2 changed files with 3 additions and 2 deletions

View File

@ -297,13 +297,14 @@ class NewAllocateView(NewActionView, DeviceListMix):
def dispatch_request(self): def dispatch_request(self):
dispatch = super().dispatch_request() dispatch = super().dispatch_request()
if dispatch.status_code == 302: if dispatch:
return dispatch return dispatch
# lot_id = self.form.lot.data # lot_id = self.form.lot.data
# FIXME # FIXME
# import pdb; pdb.set_trace() # import pdb; pdb.set_trace()
self.get_context(None) self.get_context(None)
self.context['form_new_allocate'] = self.form
return flask.render_template(self.template_name, **self.context) return flask.render_template(self.template_name, **self.context)

View File

@ -25,7 +25,7 @@
{{ field.label(class_="form-label") }} {{ field.label(class_="form-label") }}
{{ field(class_="form-control") }} {{ field(class_="form-control") }}
{% if field.errors %} {% if field.errors %}
<p class="text-danger {% if field.errors %}field-error{% endif %}"> <p class="text-danger">
{% for error in field.errors %} {% for error in field.errors %}
{{ error }}<br/> {{ error }}<br/>
{% endfor %} {% endfor %}