Commit 7ddb627b authored by klafyvel's avatar klafyvel
Browse files

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

parent 92e6ae45
......@@ -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))
Supports Markdown
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