mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 08:32:26 +00:00
Do not create an useless list since set
can be created from any iterable.
This commit is contained in:
parent
92e6ae45ad
commit
7ddb627b6b
1 changed files with 1 additions and 1 deletions
|
@ -284,7 +284,7 @@ class Switch(AclMixin, Machine):
|
||||||
if end < begin:
|
if end < begin:
|
||||||
raise ValidationError(_("The end port is less than the start"
|
raise ValidationError(_("The end port is less than the start"
|
||||||
" port."))
|
" port."))
|
||||||
ports_to_create = list(range(begin, end + 1))
|
ports_to_create = range(begin, end + 1)
|
||||||
existing_ports = Port.objects.filter(switch=self.switch).values_list('port', flat=True)
|
existing_ports = Port.objects.filter(switch=self.switch).values_list('port', flat=True)
|
||||||
non_existing_ports = list(set(ports_to_create) - set(existing_ports))
|
non_existing_ports = list(set(ports_to_create) - set(existing_ports))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue