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

Optimisation des requêtes.

parent f1d96c19
......@@ -422,11 +422,12 @@ def create_ports(request, switch_id):
messages.error(request, u"Switch inexistant")
return redirect("/topologie/")
ports = switch.ports.order_by('port')
s_begin = s_end = 0
if len(ports) > 0:
nb_ports = switch.ports.count()
if nb_ports > 0:
ports = switch.ports.order_by('port')
s_begin = ports[0].port
s_end = ports[len(ports)-1].port
s_end = ports.last().port
port_form = CreatePortsForm(
request.POST or None,
......
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