Store custom field default values as JSON #4323

Closed
opened 2025-12-29 18:34:44 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Dec 1, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.10-beta1

Proposed Functionality

The CustomField model's default field should be a JSONField rather than a CharField.

Use Case

Using a JSONField permits the storage of a default value in its native type, and avoids the need for clunky deserialization (e.g. storing the string "false" for a boolean field).

Database Changes

Migrate the default field to a JSONField and update all existing values accordingly.

External Dependencies

None

Originally created by @jeremystretch on GitHub (Dec 1, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.10-beta1 ### Proposed Functionality The CustomField model's `default` field should be a JSONField rather than a CharField. ### Use Case Using a JSONField permits the storage of a default value in its native type, and avoids the need for clunky deserialization (e.g. storing the string "false" for a boolean field). ### Database Changes Migrate the `default` field to a JSONField and update all existing values accordingly. ### External Dependencies None
adam added the status: acceptedtype: housekeepingbeta labels 2025-12-29 18:34:44 +01:00
adam closed this issue 2025-12-29 18:34:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4323