mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Permit merging dict value with existing dict in user config
This commit is contained in:
parent
7e1f4ef07e
commit
289836f9f6
@ -140,7 +140,10 @@ class UserConfig(models.Model):
|
|||||||
# Set a key based on the last item in the path. Raise TypeError if attempting to overwrite a non-leaf node.
|
# Set a key based on the last item in the path. Raise TypeError if attempting to overwrite a non-leaf node.
|
||||||
key = keys[-1]
|
key = keys[-1]
|
||||||
if key in d and type(d[key]) is dict:
|
if key in d and type(d[key]) is dict:
|
||||||
raise TypeError(f"Key '{path}' has child keys; cannot assign a value")
|
if type(value) is dict:
|
||||||
|
d[key].update(value)
|
||||||
|
else:
|
||||||
|
raise TypeError(f"Key '{path}' is a dictionary; cannot assign a non-dictionary value")
|
||||||
else:
|
else:
|
||||||
d[key] = value
|
d[key] = value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user