From 289836f9f6273ae0fbee8818a279c9e7d5d1ff7d Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 21 Feb 2023 16:25:52 -0500 Subject: [PATCH] Permit merging dict value with existing dict in user config --- netbox/users/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netbox/users/models.py b/netbox/users/models.py index 07e903569..4e7d9ca52 100644 --- a/netbox/users/models.py +++ b/netbox/users/models.py @@ -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. key = keys[-1] 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: d[key] = value