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):
|
class AllocateForm(ActionFormMix):
|
||||||
|
date = HiddenField('')
|
||||||
start_time = DateField('Start time')
|
start_time = DateField('Start time')
|
||||||
end_time = DateField('End time', [validators.Optional()])
|
end_time = DateField('End time', [validators.Optional()])
|
||||||
final_user_code = StringField(
|
final_user_code = StringField(
|
||||||
|
@ -692,7 +693,7 @@ class AllocateForm(ActionFormMix):
|
||||||
transaction = StringField(
|
transaction = StringField(
|
||||||
'Transaction', [validators.Optional(), validators.length(max=50)]
|
'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):
|
def validate(self, extra_validators=None):
|
||||||
if not super().validate(extra_validators):
|
if not super().validate(extra_validators):
|
||||||
|
|
|
@ -326,7 +326,8 @@ class NewAllocateView(NewActionView, DeviceListMix):
|
||||||
messages.error('Action {} error!'.format(self.form.type.data))
|
messages.error('Action {} error!'.format(self.form.type.data))
|
||||||
for k, v in self.form.errors.items():
|
for k, v in self.form.errors.items():
|
||||||
value = ';'.join(v)
|
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()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ field.label(class_="form-label") }}
|
{{ field.label(class_="form-label") }}
|
||||||
|
{% if field == form_new_allocate.start_time %}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
{% endif %}
|
||||||
{{ field(class_="form-control") }}
|
{{ field(class_="form-control") }}
|
||||||
{% if field.errors %}
|
{% if field.errors %}
|
||||||
<p class="text-danger">
|
<p class="text-danger">
|
||||||
|
|
Reference in New Issue