Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FLASK-WTFromds file:
- class NonValidatingSelectField(SelectField):
- def pre_validate(self, form):
- pass
- device_model = NonValidatingSelectField('MODEL', validators=[Optional()], choices=[('0','No selection')]+[])
- ######################################################
- HTML file
- <div class="card-block edit wrapper">
- <div class="form-group input-form-group">
- {% for line in form.devices %}
- {{ line.hidden_tag() }}
- <div class="row">
- <div class="col">
- {{ line.device_type.label}}
- {{ line.device_type(class='form-control custom-select device-type') }}
- {% for error in line.device_type.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col">
- {{ line.device_subtype.label }}
- {% if line.device_type.data == 'Misc' %}
- {{ line.device_subtype(class='form-control custom-select device-subtype') }}
- {% else %}
- {{ line.device_subtype(class='form-control custom-select device-subtype', disabled=true) }}
- {% endif %}
- {% for error in line.device_subtype.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col-3">
- {{ line.device_model.label}}
- {% if line.device_type.data == 'Software' %}
- {{ line.device_model(class='form-control device-model', disabled=true) }}
- {% else %}
- {{ line.device_model(class='form-control device-model') }}
- {% endif %}
- {% for error in line.device_model.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col-1">
- {{ line.device_count.label}}
- {{ line.device_count(class='form-control device-count') }}
- {% for error in line.device_count.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col">
- {{ line.device_label.label}}
- {% if line.device_type.data == 'Misc' or line.device_type.data == 'Software' %}
- {{ line.device_label(class='form-control device-label', disabled=true) }}
- {% else %}
- {{ line.device_label(class='form-control device-label', required=true) }}
- {% endif %}
- <small class="form-text text-muted device-label-help"></small>
- {% for error in line.device_label.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col">
- {{ line.device_comment.label}}
- {% if line.device_type.data == 'Software' %}
- {{ line.device_comment(class='form-control device-comment', required=true) }}
- {% else %}
- {{ line.device_comment(class='form-control device-comment') }}
- {% endif %}
- {% for error in line.device_comment.errors %}
- <p class="form-control-status text-danger">
- {{ error }}
- </p>
- {% endfor %}
- </div>
- <div class="col">
- <label> </label>
- {{ line.delete_line(class='btn btn-danger pull-xs-left') }}
- </div>
- </div>
- {% endfor %}
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement