Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 1e9a4b3d authored by Alexandre Iooss's avatar Alexandre Iooss Committed by Levy--Falk Hugo

Autoformat templates

parent 92e66bb1
......@@ -28,21 +28,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Aliases" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Aliases" %}</th>
<th></th>
</tr>
</thead>
{% for alias in alias_list %}
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% history_button alias %}
</td>
</tr>
{% endfor %}
</table>
......@@ -26,11 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Target zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Target zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<tr>
......@@ -38,11 +38,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ dname.dns_entry }}</td>
<td class="text-right">
{% can_edit dname %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% acl_end %}
{% history_button dname %}
</td>
</tr>
{% endfor %}
</table>
......@@ -30,34 +30,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "SOA record" %}</th>
<th>{% trans "A record origin" %}</th>
{% if ipv6_enabled %}
<th>{% trans "AAAA record origin" %}</th>
{% endif %}
<th></th>
</tr>
</thead>
{% for extension in extension_list %}
<tr>
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra|tick }}</td>
<td>{{ extension.soa }}</td>
<td>{{ extension.origin }}</td>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "SOA record" %}</th>
<th>{% trans "A record origin" %}</th>
{% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td>
<th>{% trans "AAAA record origin" %}</th>
{% endif %}
<td class="text-right">
{% can_edit extension %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %}
{% history_button extension %}
</td>
<th></th>
</tr>
</thead>
{% for extension in extension_list %}
<tr>
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra|tick }}</td>
<td>{{ extension.soa }}</td>
<td>{{ extension.origin }}</td>
{% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td>
{% endif %}
<td class="text-right">
{% can_edit extension %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %}
{% history_button extension %}
</td>
</tr>
{% endfor %}
</table>
</div>
......@@ -31,36 +31,36 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "IP type" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "IPv4 range" %}</th>
<th>{% trans "v6 prefix" %}</th>
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
<th>{% trans "On VLAN(s)" %}</th>
<th>{% trans "Default ports opening" %}</th>
<th></th>
</tr>
</thead>
{% for type in iptype_list %}
<tr>
<td>{{ type.type }}</td>
<td>{{ type.extension }}</td>
<td>{{ type.need_infra|tick }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </b></u>{{ type.ip_network }}{% endif %}</td>
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
<td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td>
<td>{{ type.vlan }}</td>
<td>{{ type.ouverture_ports }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
<th>{% trans "IP type" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "IPv4 range" %}</th>
<th>{% trans "v6 prefix" %}</th>
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
<th>{% trans "On VLAN(s)" %}</th>
<th>{% trans "Default ports opening" %}</th>
<th></th>
</tr>
</thead>
{% for type in iptype_list %}
<tr>
<td>{{ type.type }}</td>
<td>{{ type.extension }}</td>
<td>{{ type.need_infra|tick }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </u></b>
{{ type.ip_network }}{% endif %}</td>
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
<td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td>
<td>{{ type.vlan }}</td>
<td>{{ type.ouverture_ports }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
</tr>
{% endfor %}
</table>
</div>
......@@ -28,26 +28,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "IPv6 addresses" %}</th>
<th>{% trans "SLAAC" %}</th>
<th></th>
</tr>
</thead>
<tr>
<th>{% trans "IPv6 addresses" %}</th>
<th>{% trans "SLAAC" %}</th>
<th></th>
</tr>
</thead>
{% for ipv6 in ipv6_list %}
<tr>
<td>{{ ipv6.ipv6 }}</td>
<td>{{ ipv6.slaac_ip }}</td>
<td class="text-right">
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% history_button ipv6 %}
</td>
</tr>
{% endfor %}
</table>
......@@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Machine type" %}</th>
<th>{% trans "Matching IP type" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Machine type" %}</th>
<th>{% trans "Matching IP type" %}</th>
<th></th>
</tr>
</thead>
{% for type in machinetype_list %}
<tr>
......@@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ type.ip_type }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
</tr>
{% endfor %}
</table>
......@@ -28,12 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
</thead>
{% for mx in mx_list %}
<tr>
......@@ -42,11 +42,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ mx.name }}</td>
<td class="text-right">
{% can_edit mx %}
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
{% acl_end %}
{% history_button mx %}
</td>
</tr>
{% endfor %}
</table>
......@@ -29,29 +29,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "NAS device type" %}</th>
<th>{% trans "Machine type linked to the NAS device" %}</th>
<th>{% trans "Access mode" %}</th>
<th>{% trans "MAC address auto capture" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "NAS device type" %}</th>
<th>{% trans "Machine type linked to the NAS device" %}</th>
<th>{% trans "Access mode" %}</th>
<th>{% trans "MAC address auto capture" %}</th>
<th></th>
</tr>
</thead>
{% for nas in nas_list %}
<tr>
<td>{{ nas.name }}</td>
<td>{{ nas.nas_type }}</td>
<td>{{ nas.nas_type }}</td>
<td>{{ nas.machine_type }}</td>
<td>{{ nas.port_access_mode }}</td>
<td>{{ nas.autocapture_mac|tick }}</td>
<td class="text-right">
{% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% history_button nas %}
</td>
</tr>
{% endfor %}
</table>
......@@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Authoritarian interface for the concerned zone" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Authoritarian interface for the concerned zone" %}</th>
<th></th>
</tr>
</thead>
{% for ns in ns_list %}
<tr>
......@@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ ns.ns }}</td>
<td class="text-right">
{% can_edit ns %}
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
{% acl_end %}
{% history_button ns %}
</td>
</tr>
{% endfor %}
</table>
......@@ -29,13 +29,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Role name" %}</th>
<th>{% trans "Specific role" %}</th>
<th>{% trans "Servers" %}</th>
<th></th>
<th></th>
</tr>
<tr>
<th>{% trans "Role name" %}</th>
<th>{% trans "Specific role" %}</th>
<th>{% trans "Servers" %}</th>
<th></th>
<th></th>
</tr>
</thead>
{% for role in role_list %}
<tr>
......@@ -43,12 +43,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ role.specific_role }}</td>
<td>{% for serv in role.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit role %}
{% include 'buttons/edit.html' with href='machines:edit-role' id=role.id %}
{% acl_end %}
{% history_button role %}
</td>
</tr>
{% can_edit role %}
{% include 'buttons/edit.html' with href='machines:edit-role' id=role.id %}
{% acl_end %}
{% history_button role %}
</td>
</tr>
{% endfor %}
</table>
......@@ -27,13 +27,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Service name" %}</th>
<th>{% trans "Server" %}</th>
<th>{% trans "Last regeneration" %}</th>
<th>{% trans "Regeneration required" %}</th>
<th>{% trans "Regeneration activated" %}</th>
</tr>
<tr>
<th>{% trans "Service name" %}</th>
<th>{% trans "Server" %}</th>
<th>{% trans "Last regeneration" %}</th>
<th>{% trans "Regeneration required" %}</th>
<th>{% trans "Regeneration activated" %}</th>
</tr>
</thead>
{% for server in servers_list %}
<tr>
......@@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
{% endfor %}
</table>
......@@ -28,14 +28,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Service name" %}</th>
<th>{% trans "Minimal time before regeneration" %}</th>
<th>{% trans "Maximal time before regeneration" %}</th>
<th>{% trans "Included servers" %}</th>
<th>{% trans "Ask for regeneration" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Service name" %}</th>
<th>{% trans "Minimal time before regeneration" %}</th>
<th>{% trans "Maximal time before regeneration" %}</th>
<th>{% trans "Included servers" %}</th>
<th>{% trans "Ask for regeneration" %}</th>
<th></th>
</tr>
</thead>
{% for service in service_list %}
<tr>
......@@ -43,14 +43,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fa fa-sync"></i></a></td>
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i
class="fa fa-sync"></i></a></td>
<td class="text-right">
{% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% history_button service %}
</td>
</tr>
{% endfor %}
</table>
......@@ -28,15 +28,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Mail" %}</th>
<th>{% trans "Refresh" %}</th>
<th>{% trans "Retry" %}</th>
<th>{% trans "Expire" %}</th>
<th>{% trans "TTL" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Mail" %}</th>
<th>{% trans "Refresh" %}</th>
<th>{% trans "Retry" %}</th>
<th>{% trans "Expire" %}</th>
<th>{% trans "TTL" %}</th>
<th></th>
</tr>
</thead>
{% for soa in soa_list %}
<tr>
......@@ -48,11 +48,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ soa.ttl }}</td>
<td class="text-right">
{% can_edit soa %}
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
{% acl_end %}
{% history_button soa %}
</td>
</tr>
{% endfor %}
</table>
......@@ -28,17 +28,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Service" %}</th>
<th>{% trans "Protocol" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "TTL" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Weight" %}</th>
<th>{% trans "Port" %}</th>
<th>{% trans "Target" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Service" %}</th>
<th>{% trans "Protocol" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "TTL" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Weight" %}</th>
<th>{% trans "Port" %}</th>
<th>{% trans "Target" %}</th>
<th></th>
</tr>
</thead>
{% for srv in srv_list %}
<tr>
......@@ -52,11 +52,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ srv.target }}</td>
<td class="text-right">
{% can_edit srv %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %}
{% history_button srv %}
</td>
</tr>
{% endfor %}
</table>
......@@ -27,12 +27,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive">
<table class="table table-striped long_text">
<thead>
<tr>
<th class="long_text">{% trans "SSH public key" %}</th>
<th>{% trans "Algorithm used" %}</th>
<th>{% trans "Comment" %}</th>
<th></th>
</tr>
<tr>
<th class="long_text">{% trans "SSH public key" %}</th>
<th>{% trans "Algorithm used" %}</th>
<th>{% trans "Comment" %}</th>
<th></th>
</tr>
</thead>
{% for sshfp in sshfp_list %}
<tr>
......@@ -41,15 +41,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ sshfp.comment }}</td>
<td class="text-right">
{% can_edit sshfp %}
{% include 'buttons/edit.html' with href='machines:edit-sshfp' id=sshfp.id %}
{% include 'buttons/edit.html' with href='machines:edit-sshfp' id=sshfp.id %}
{% acl_end %}
{% history_button sshfp %}
{% can_delete sshfp %}
{% include 'buttons/suppr.html' with href='machines:del-sshfp' id=sshfp.id %}
{% include 'buttons/suppr.html' with href='machines:del-sshfp' id=sshfp.id %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
</div>
......@@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
</thead>
{% for txt in txt_list %}
<tr>
......@@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ txt.dns_entry }}</td>
<td class="text-right">
{% can_edit txt %}
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
{% acl_end %}
{% history_button txt %}
</td>
</tr>
{% endfor %}
</table>
......@@ -29,23 +29,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Comment" %}</th>
<th>{% trans "IP ranges" %}</th>
<th></th>
</tr>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Comment" %}</th>
<th>{% trans "IP ranges" %}</th>
<th></th>
</tr>
</thead>
{% for vlan in vlan_list %}
<tr>
<td>{{ vlan.vlan_id }}</td>
<td>{{ vlan.name }}</td>
<td>{{ vlan.name }}</td>
<td>{{ vlan.comment }}</td>
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%}</td>
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor %}</td>
<td class="text-right">
{% can_edit vlan %}
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
{% acl_end %}
{% history_button vlan %}
</td>
......@@ -53,4 +53,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
</div>
......@@ -30,14 +30,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %}
<form class="form" method="post">
{% csrf_token %}
<h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }} )?{% endblocktrans %}</h4>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %}
</form>
<br />
<br />
<br />
<form class="form" method="post">
{% csrf_token %}
<h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }}
)?{% endblocktrans %}</h4>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %}
</form>
<br/>
<br/>
<br/>
{% endblock %}
......@@ -29,44 +29,45 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Machines" %}{% endblock %}
{% block content %}
{% bootstrap_form_errors port_list %}
{% bootstrap_form_errors port_list %}
<form class="form" method="post">
{% csrf_token %}
{% bootstrap_form port_list %}
{{ ports.management_form }}
<div id="formset">
{% for form in ports.forms %}
<div class="port">
<p>
{{ form }}
</p>
</div>
{% endfor %}
</div>
<form class="form" method="post">
{% csrf_token %}
{% bootstrap_form port_list %}
{{ ports.management_form }}
<div id="formset">
{% for form in ports.forms %}
<div class="port">
<p>
{{ form }}
</p>
</div>
{% endfor %}
</div>
<p>
{% trans "Add a port" as value %}
<input class="btn btn-primary btn-sm" role="button" value=value id="add_one">
</p>
{% trans "Create or edit" as tr_create_or_edit %}
{% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %}
</form>
<script type="text/javascript">
var template = `{{ports.empty_form}}`;
function add_port(){
var new_index = document.getElementsByClassName('port').length;
document.getElementById('id_form-TOTAL_FORMS').value =
parseInt(document.getElementById('id_form-TOTAL_FORMS').value) + 1;
var new_port = document.createElement('div');
new_port.className = 'port';
new_port.innerHTML = template.replace(/__prefix__/g, new_index);
document.getElementById('formset').appendChild(new_port);
}
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("add_one").addEventListener("click", add_port, true);});
<p>
{% trans "Add a port" as value %}
<input class="btn btn-primary btn-sm" role="button" value="value" id="add_one">
</p>
{% trans "Create or edit" as tr_create_or_edit %}
{% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %}