Fix the default creation value for weight
This commit is contained in:
parent
170bf4e03d
commit
5a1f6f6dd9
|
@ -60,10 +60,7 @@ with open('/opt/netbox/initializers/custom_fields.yml', 'r') as stream:
|
||||||
choice, _ = CustomFieldChoice.objects.get_or_create(
|
choice, _ = CustomFieldChoice.objects.get_or_create(
|
||||||
field=custom_field,
|
field=custom_field,
|
||||||
value=choice_details['value'],
|
value=choice_details['value'],
|
||||||
|
defaults={'weight': idx * 10}
|
||||||
)
|
)
|
||||||
# Add weight after initial creation to fix a bug if you use the same 'value'
|
|
||||||
# for multiple custom fields.
|
|
||||||
choice.weight = choice_details.get('weight', idx * 10)
|
|
||||||
choice.save()
|
|
||||||
|
|
||||||
print("🔧 Created custom field", cf_name)
|
print("🔧 Created custom field", cf_name)
|
||||||
|
|
Loading…
Reference in New Issue