Commit e3bd4e7c authored by LEVY-FALK Hugo's avatar LEVY-FALK Hugo Committed by root

Intégration à la page /topologie/switch/

parent d1e34d79
......@@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% 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: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 %}
{% include "topologie/aff_port.html" with port_list=port_list %}
<br />
......
......@@ -440,10 +440,10 @@ def create_ports(request, switch_id):
e = []
if end < begin:
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:
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:
b = range(begin, s_begin)
......@@ -461,7 +461,7 @@ def create_ports(request, switch_id):
messages.success(request, "Création du port %d" % i)
except IntegrityError:
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment