Skip to content

Commit 94c3b50

Browse files
authored
Add bulk import buttons to custom objects in nav menu (#289)
1 parent 643856f commit 94c3b50

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

netbox_custom_objects/navigation.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@ def __iter__(self):
3939
"custom_object_type": custom_object_type.slug
4040
},
4141
)
42+
bulk_import_button = PluginMenuButton(
43+
None,
44+
_('Import'),
45+
'mdi mdi-upload'
46+
)
47+
bulk_import_button.url = reverse_lazy(
48+
f"plugins:{APP_LABEL}:customobject_bulk_import",
49+
kwargs={
50+
"custom_object_type": custom_object_type.slug
51+
},
52+
)
4253
menu_item = PluginMenuItem(
4354
link=None,
4455
link_text=_(title(model._meta.verbose_name_plural)),
45-
buttons=(add_button,),
56+
buttons=(add_button, bulk_import_button),
4657
auth_required=True,
4758
)
4859
menu_item.url = reverse_lazy(

0 commit comments

Comments
 (0)