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

Fixes #6131: Correct handling of boolean fields when cloning objects

This commit is contained in:
jeremystretch
2021-04-09 14:42:07 -04:00
parent 4dfba3a2ad
commit 2cc088c633
2 changed files with 4 additions and 3 deletions

View File

@@ -224,12 +224,12 @@ def prepare_cloned_fields(instance):
field = instance._meta.get_field(field_name)
field_value = field.value_from_object(instance)
# Swap out False with URL-friendly value
# Pass False as null for boolean fields
if field_value is False:
field_value = ''
params.append((field_name, ''))
# Omit empty values
if field_value not in (None, ''):
elif field_value not in (None, ''):
params.append((field_name, field_value))
# Copy tags