Skip to content

Commit a47c8d2

Browse files
authored
Merge pull request #63 from matejv/custom-fields
add new attributes to CustomField
2 parents 628498e + 9b1f5fa commit a47c8d2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/netbox_initializers/initializers/custom_fields.py

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def load_data(self):
5555
if cf_details.get("ui_visibility", False):
5656
custom_field.ui_visibility = cf_details["ui_visibility"]
5757

58+
if cf_details.get("search_weight", -1) >= 0:
59+
custom_field.search_weight = cf_details["search_weight"]
60+
61+
if cf_details.get("is_cloneable", None) is not None:
62+
custom_field.is_cloneable = cf_details["is_cloneable"]
63+
5864
# object_type should only be applied when type is object, multiobject
5965
if cf_details.get("object_type"):
6066
if cf_details.get("type") not in (

src/netbox_initializers/initializers/yaml/custom_fields.yml

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# weight: 0
2929
# group_name: group1
3030
# ui_visibility: read-only
31+
# search_weight: 100
3132
# on_objects:
3233
# - dcim.models.Device
3334
# - dcim.models.Rack
@@ -47,6 +48,7 @@
4748
# validation_maximum: 255
4849
# weight: 10
4950
# group_name: group1
51+
# is_cloneable: false
5052
# on_objects:
5153
# - tenancy.models.Tenant
5254
# select_field:
@@ -56,6 +58,7 @@
5658
# filter_logic: exact
5759
# weight: 30
5860
# default: First Item
61+
# is_cloneable: true
5962
# on_objects:
6063
# - dcim.models.Device
6164
# choices:

0 commit comments

Comments
 (0)