Parsing error handling and MAC retrieval on new snapshots #27
|
@ -15,7 +15,7 @@ from utils.save_snapshots import move_json, save_in_disk
|
||||||
class UploadForm(forms.Form):
|
class UploadForm(forms.Form):
|
||||||
evidence_file = MultipleFileField(label=_("File"))
|
evidence_file = MultipleFileField(label=_("File"))
|
||||||
|
|
||||||
def clean(self):
|
def clean_evidence_file(self):
|
||||||
self.evidences = []
|
self.evidences = []
|
||||||
data = self.cleaned_data.get('evidence_file')
|
data = self.cleaned_data.get('evidence_file')
|
||||||
if not data:
|
if not data:
|
||||||
|
|
|
@ -8,22 +8,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- override invalid-feedback class -->
|
||||||
|
<style>
|
||||||
|
.invalid-feedback {
|
||||||
|
color: #670000;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
{% load django_bootstrap5 %}
|
{% load django_bootstrap5 %}
|
||||||
<form role="form" method="post" enctype="multipart/form-data">
|
<form role="form" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if form.errors %}
|
|
||||||
<div class="alert alert-danger alert-icon alert-icon-border alert-dismissible" role="alert">
|
{% bootstrap_form form alert_error_type="none" error_css_class="alert alert-danger alert-icon alert-icon-border" %}
|
||||||
<div class="icon"><span class="mdi mdi-close-circle-o"></span></div>
|
<div class="form-actions-no-box">
|
||||||
<div class="message">
|
|
||||||
{% for error in form.non_field_errors %}
|
|
||||||
{{ error }}<br />
|
|
||||||
{% endfor %}
|
|
||||||
<button class="btn-close" type="button" data-dismiss="alert" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% bootstrap_form form alert_error_type="fields" %}
|
|
||||||
<div class="form-actions-no-box">
|
|
||||||
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
||||||
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue