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

Convert remaining DCIM models to use NaturalOrderingField

This commit is contained in:
Jeremy Stretch
2020-02-07 11:54:34 -05:00
parent 705c352885
commit 099c446f38
4 changed files with 100 additions and 26 deletions

View File

@ -20,6 +20,8 @@ def naturalize(value, max_length=None, integer_places=8):
:param max_length: The maximum length of the returned string. Characters beyond this length will be stripped.
:param integer_places: The number of places to which each integer will be expanded. (Default: 8)
"""
if not value:
return ''
output = []
for segment in re.split(r'(\d+)', value):
if segment.isdigit():