8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-02 07:52:23 +00:00

Do not create an useless list since set can be created from any iterable.

This commit is contained in:
klafyvel 2018-12-30 14:27:41 +01:00
parent 92e6ae45ad
commit 7ddb627b6b

View file

@ -284,7 +284,7 @@ class Switch(AclMixin, Machine):
if end < begin:
raise ValidationError(_("The end port is less than the start"
" 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)
non_existing_ports = list(set(ports_to_create) - set(existing_ports))