8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-26 00:43:46 +00:00

Moins de requêtes

This commit is contained in:
Hugo LEVY-FALK 2017-10-26 11:51:41 +02:00
parent af9e7a8650
commit 457a098406

View file

@ -425,9 +425,9 @@ def create_ports(request, switch_id):
s_begin = s_end = 0 s_begin = s_end = 0
nb_ports = switch.ports.count() nb_ports = switch.ports.count()
if nb_ports > 0: if nb_ports > 0:
ports = switch.ports.order_by('port') ports = switch.ports.order_by('port').values('port')
s_begin = ports[0].port s_begin = ports.first().get('port')
s_end = ports.last().port s_end = ports.last().get('port')
port_form = CreatePortsForm( port_form = CreatePortsForm(
request.POST or None, request.POST or None,