Browse Source

Intégration à la page /topologie/switch/

refactor_history
LEVY-FALK Hugo 8 years ago
committed by root
parent
commit
e3bd4e7ce3
  1. 1
      topologie/templates/topologie/index_p.html
  2. 6
      topologie/views.py

1
topologie/templates/topologie/index_p.html

@ -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 />

6
topologie/views.py

@ -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)

Loading…
Cancel
Save