Open peteeckel opened 3 months ago
I did not run the NetBox test suite yet, but there seems to be a trivial fix:
(netbox) [root@dns netbox]# git diff
diff --git a/netbox/utilities/querydict.py b/netbox/utilities/querydict.py
index 78395758a..dbe2e4281 100644
--- a/netbox/utilities/querydict.py
+++ b/netbox/utilities/querydict.py
@@ -55,7 +55,7 @@ def prepare_cloned_fields(instance):
for key, value in attrs.items():
if type(value) in (list, tuple):
params.extend([(key, v) for v in value])
- elif value is not False and value is not None:
+ elif value is not None:
params.append((key, value))
else:
params.append((key, ''))
@peteeckel do you want to take this one?
@peteeckel do you want to take this one?
Sure, I'll be glad to.
Deployment Type
Self-hosted
NetBox Version
v4.0.8
Python Version
3.11
Steps to Reproduce
ipam.IPAddress
False
for an arbitraryIPAddress
object and click on 'Save'Expected Behavior
The cloned object has its 'test' CF set to
False
Observed Behavior
The cloned object has its 'test' CF set to
None
If you look at the parameters of the URL for the 'Clone' button, the relevant part is
test=
. This is identical whether the CF 'test' wasFalse
for the original object or if it was undefined.This is particularly relevant for required fields, as it makes it necessary to set the field explicitly for cloned objects even if cloning the field was enabled.