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

Add all() method to UserConfig

This commit is contained in:
Jeremy Stretch
2020-04-24 09:50:26 -04:00
parent d8494e44e7
commit 7c8c85e435
3 changed files with 40 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from utilities.utils import flatten_dict
__all__ = (
'Token',
@@ -54,6 +56,12 @@ class UserConfig(models.Model):
return d
def all(self):
"""
Return a dictionary of all defined keys and their values.
"""
return flatten_dict(self.data)
def set(self, path, value, commit=False):
"""
Define or overwrite a configuration parameter. Example: