-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Copy link
Labels
complexity: lowRequires minimal effort to implementRequires minimal effort to implementstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Milestone
Description
NetBox version
v4.4.0
Feature type
Change to existing functionality
Proposed functionality
Tweak the deserialize_object() function in utilities.serialization to support assigning object attributes from serialized data. Currently, only the assignment of values to model fields is supported, due to how Django's native deserialization works.
For example, given the following model:
class Foo(models.Model):
name = models.CharField()
number = models.IntegerField()The following code should set a = True on the resulting instance, even though a is not a field on the model:
deserialize_object(Foo, {
"name": "Test",
"number": 123,
"a": True,
})Use case
This will expand the usefulness of the function, allowing it to serve additional use cases.
Database changes
N/A
External dependencies
N/A
Metadata
Metadata
Assignees
Labels
complexity: lowRequires minimal effort to implementRequires minimal effort to implementstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application