mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Optimisation des requêtes.
This commit is contained in:
parent
f1d96c196c
commit
9c1833ed8f
1 changed files with 4 additions and 3 deletions
|
@ -422,11 +422,12 @@ def create_ports(request, switch_id):
|
||||||
messages.error(request, u"Switch inexistant")
|
messages.error(request, u"Switch inexistant")
|
||||||
return redirect("/topologie/")
|
return redirect("/topologie/")
|
||||||
|
|
||||||
ports = switch.ports.order_by('port')
|
|
||||||
s_begin = s_end = 0
|
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_begin = ports[0].port
|
||||||
s_end = ports[len(ports)-1].port
|
s_end = ports.last().port
|
||||||
|
|
||||||
port_form = CreatePortsForm(
|
port_form = CreatePortsForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
|
|
Loading…
Reference in a new issue