Skip to content

Commit e3da475

Browse files
authored
update custom_fields model (#29)
add group_name and ui_visibility fields
1 parent 65bd320 commit e3da475

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/netbox_initializers/initializers/custom_fields.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ def load_data(self):
4949
if cf_details.get("weight", -1) >= 0:
5050
custom_field.weight = cf_details["weight"]
5151

52+
if cf_details.get("group_name", False):
53+
custom_field.group_name = cf_details["group_name"]
54+
55+
if cf_details.get("ui_visibility", False):
56+
custom_field.ui_visibility = cf_details["ui_visibility"]
57+
5258
# object_type should only be applied when type is object, multiobject
5359
if cf_details.get("object_type"):
5460
if cf_details.get("type") not in (

src/netbox_initializers/initializers/yaml/custom_fields.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
## - disabled
1414
## - loose
1515
## - exact
16+
## ui_visibility:
17+
## - read-write
18+
## - read-only
19+
## - hidden
1620
##
1721
## Examples:
1822

@@ -22,6 +26,8 @@
2226
# description: Enter text in a text field.
2327
# required: false
2428
# weight: 0
29+
# group_name: group1
30+
# ui_visibility: read-only
2531
# on_objects:
2632
# - dcim.models.Device
2733
# - dcim.models.Rack
@@ -40,6 +46,7 @@
4046
# validation_minimum: 0
4147
# validation_maximum: 255
4248
# weight: 10
49+
# group_name: group1
4350
# on_objects:
4451
# - tenancy.models.Tenant
4552
# select_field:

0 commit comments

Comments
 (0)