Merge pull request #269 from eReuse/bugfix/allocate-bugs
Bugfix/allocate bugs
This commit is contained in:
commit
5026768eb5
|
@ -684,6 +684,7 @@ class NewActionForm(ActionFormMix):
|
|||
|
||||
|
||||
class AllocateForm(ActionFormMix):
|
||||
date = HiddenField('')
|
||||
start_time = DateField('Start time')
|
||||
end_time = DateField('End time', [validators.Optional()])
|
||||
final_user_code = StringField(
|
||||
|
@ -692,7 +693,7 @@ class AllocateForm(ActionFormMix):
|
|||
transaction = StringField(
|
||||
'Transaction', [validators.Optional(), validators.length(max=50)]
|
||||
)
|
||||
end_users = IntegerField('End users', [validators.Optional()])
|
||||
end_users = IntegerField('Number of end users', [validators.Optional()])
|
||||
|
||||
def validate(self, extra_validators=None):
|
||||
if not super().validate(extra_validators):
|
||||
|
|
|
@ -326,7 +326,8 @@ class NewAllocateView(NewActionView, DeviceListMix):
|
|||
messages.error('Action {} error!'.format(self.form.type.data))
|
||||
for k, v in self.form.errors.items():
|
||||
value = ';'.join(v)
|
||||
messages.error('Action Error {key}: {value}!'.format(key=k, value=value))
|
||||
key = self.form[k].label.text
|
||||
messages.error('Action Error {key}: {value}!'.format(key=key, value=value))
|
||||
next_url = self.get_next_url()
|
||||
return flask.redirect(next_url)
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
{% else %}
|
||||
<div class="col-12">
|
||||
{{ field.label(class_="form-label") }}
|
||||
{% if field == form_new_allocate.start_time %}
|
||||
<span class="text-danger">*</span>
|
||||
{% endif %}
|
||||
{{ field(class_="form-control") }}
|
||||
{% if field.errors %}
|
||||
<p class="text-danger">
|
||||
|
|
Reference in a new issue