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

Fixes #4166: Fix schema migrations to enforce maximum character length for naturalized fields

This commit is contained in:
Jeremy Stretch
2020-02-13 21:41:00 -05:00
parent 4d50cad6ed
commit 909323663e
8 changed files with 25 additions and 11 deletions

View File

@ -86,7 +86,7 @@ class Command(BaseCommand):
# Find all unique values for the field
queryset = model.objects.values_list(target_field, flat=True).order_by(target_field).distinct()
for value in queryset:
naturalized_value = naturalize(value)
naturalized_value = naturalize(value, max_length=field.max_length)
if options['verbosity'] >= 2:
self.stdout.write(" {} -> {}".format(value, naturalized_value), ending='')