8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Intégration à la page /topologie/switch/

This commit is contained in:
LEVY-FALK Hugo 2017-10-26 11:14:16 +02:00 committed by root
parent d1e34d795d
commit e3bd4e7ce3
2 changed files with 4 additions and 3 deletions

View file

@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if is_infra %} {% if is_infra %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:edit-switch' id_switch %}"><i class="glyphicon glyphicon-edit"></i> Editer</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:edit-switch' id_switch %}"><i class="glyphicon glyphicon-edit"></i> Editer</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port' id_switch %}"><i class="glyphicon glyphicon-plus"></i> Ajouter un port</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port' id_switch %}"><i class="glyphicon glyphicon-plus"></i> Ajouter un port</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:create-ports' id_switch %}"><i class="glyphicon glyphicon-plus"></i> Ajouter des ports</a>
{% endif %} {% endif %}
{% include "topologie/aff_port.html" with port_list=port_list %} {% include "topologie/aff_port.html" with port_list=port_list %}
<br /> <br />

View file

@ -440,10 +440,10 @@ def create_ports(request, switch_id):
e = [] e = []
if end < begin: if end < begin:
messages.error(request, "Port de fin inférieur au port de début !") messages.error(request, "Port de fin inférieur au port de début !")
return redirect("/topologie/") return redirect("/topologie/switch/" + str(switch.id))
if end - begin > switch.number: if end - begin > switch.number:
messages.error(request, "Ce switch ne peut avoir autant de ports.") messages.error(request, "Ce switch ne peut avoir autant de ports.")
return redirect("/topologie/") return redirect("/topologie/switch/" + str(switch.id))
if begin < s_begin: if begin < s_begin:
b = range(begin, s_begin) b = range(begin, s_begin)
@ -461,7 +461,7 @@ def create_ports(request, switch_id):
messages.success(request, "Création du port %d" % i) messages.success(request, "Création du port %d" % i)
except IntegrityError: except IntegrityError:
messages.error(request, "Création d'un port existant.") messages.error(request, "Création d'un port existant.")
return redirect("/topologie/") return redirect("/topologie/switch/" + str(switch.id))
return form({'topoform': port_form,}, 'topologie/switch.html', request) return form({'topoform': port_form,}, 'topologie/switch.html', request)