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

Store empty names as null

This commit is contained in:
Jeremy Stretch
2020-02-07 12:24:38 -05:00
parent c72a353733
commit dc1b7874ff
3 changed files with 11 additions and 7 deletions

View File

@@ -1321,7 +1321,8 @@ class Device(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
_name = NaturalOrderingField(
target_field='name',
max_length=100,
blank=True
blank=True,
null=True
)
serial = models.CharField(
max_length=50,
@@ -1438,7 +1439,7 @@ class Device(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
}
class Meta:
ordering = ('_name', 'pk') # Name may be blank
ordering = ('_name', 'pk') # Name may be null
unique_together = (
('site', 'tenant', 'name'), # See validate_unique below
('rack', 'position', 'face'),