1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #4336: Ensure interfaces without a subinterface ID are ordered before subinterface zero

This commit is contained in:
Jeremy Stretch
2020-04-21 16:13:34 -04:00
parent ada55dfdfb
commit 131d2c97ca
7 changed files with 56 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ from extras.models import ObjectChange, TaggedItem
from extras.utils import extras_features
from utilities.fields import NaturalOrderingField
from utilities.ordering import naturalize_interface
from utilities.query_functions import CollateAsChar
from utilities.utils import serialize_object
from virtualization.choices import VMInterfaceTypeChoices
@@ -676,7 +677,7 @@ class Interface(CableTermination, ComponentModel):
class Meta:
# TODO: ordering and unique_together should include virtual_machine
ordering = ('device', '_name')
ordering = ('device', CollateAsChar('_name'))
unique_together = ('device', 'name')
def __str__(self):