netbox-device-view 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,23 @@
1
- from netbox.forms import NetBoxModelForm
1
+ from netbox.forms import NetBoxModelForm, NetBoxModelImportForm
2
+ from django.utils.translation import gettext_lazy as _
2
3
  from .models import DeviceView
4
+ from dcim.models import DeviceType
5
+ from utilities.forms.fields import CSVModelChoiceField
3
6
 
4
7
 
5
8
  class DeviceViewForm(NetBoxModelForm):
6
9
  class Meta:
7
10
  model = DeviceView
8
11
  fields = ("device_type", "grid_template_area")
12
+
13
+
14
+ class DeviceViewImportForm(NetBoxModelImportForm):
15
+ device_type = CSVModelChoiceField(
16
+ queryset=DeviceType.objects.all(),
17
+ to_field_name="model",
18
+ help_text=_("Device Model Name"),
19
+ )
20
+
21
+ class Meta:
22
+ model = DeviceView
23
+ fields = ("device_type", "grid_template_area")
@@ -7,7 +7,12 @@ deviceview_buttons = [
7
7
  title="Add",
8
8
  icon_class="mdi mdi-plus-thick",
9
9
  color=ButtonColorChoices.GREEN,
10
- )
10
+ ),
11
+ PluginMenuButton(
12
+ link="plugins:netbox_device_view:deviceview_import",
13
+ title="Import",
14
+ icon_class="mdi mdi-upload",
15
+ ),
11
16
  ]
12
17
 
13
18
  menu_items = (
@@ -5,6 +5,11 @@ from netbox.views.generic import ObjectChangeLogView
5
5
  urlpatterns = (
6
6
  path("device-view/", views.DeviceViewListView.as_view(), name="deviceview_list"),
7
7
  path("device-view/add/", views.DeviceViewEditView.as_view(), name="deviceview_add"),
8
+ path(
9
+ "device-view/import/",
10
+ views.DeviceViewBulkImportView.as_view(),
11
+ name="deviceview_import",
12
+ ),
8
13
  path("device-view/<int:pk>/", views.DeviceViewView.as_view(), name="deviceview"),
9
14
  path(
10
15
  "device-view/<int:pk>/edit/",
@@ -61,7 +61,7 @@ def prepare(obj):
61
61
  ports_chassis = process_ports(
62
62
  ConsolePort.objects.filter(device_id=obj.id),
63
63
  ports_chassis,
64
- list(ports_chassis.keys())[0],
64
+ obj.name,
65
65
  )
66
66
  else:
67
67
  for member in obj.virtual_chassis.members.all():
@@ -6,6 +6,9 @@ from .utils import prepare
6
6
  from django.http import HttpResponse
7
7
  import pprint
8
8
 
9
+ from netbox.views.generic import BulkImportView
10
+ from netbox_device_view.forms import DeviceViewImportForm
11
+
9
12
 
10
13
  class DeviceViewView(generic.ObjectView):
11
14
  queryset = models.DeviceView.objects
@@ -21,6 +24,11 @@ class DeviceViewEditView(generic.ObjectEditView):
21
24
  form = forms.DeviceViewForm
22
25
 
23
26
 
27
+ class DeviceViewBulkImportView(BulkImportView):
28
+ queryset = models.DeviceView.objects.all()
29
+ model_form = DeviceViewImportForm
30
+
31
+
24
32
  class DeviceViewDeleteView(generic.ObjectDeleteView):
25
33
  queryset = models.DeviceView.objects
26
34
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: netbox-device-view
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: NetBox Device View plugin
5
5
  Home-page: https://github.com/peterbaumert/netbox-device-view
6
6
  Author: Peter Baumert
@@ -8,6 +8,13 @@ Keywords: netbox,netbox-plugin
8
8
  Classifier: Framework :: Django
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Description-Content-Type: text/markdown
11
+ Dynamic: author
12
+ Dynamic: classifier
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: home-page
16
+ Dynamic: keywords
17
+ Dynamic: summary
11
18
 
12
19
  # Netbox Device View Plugin
13
20
  ![Version](https://img.shields.io/pypi/v/netbox-device-view) ![Downloads](https://img.shields.io/pypi/dm/netbox-device-view)
@@ -1,13 +1,13 @@
1
1
  netbox_device_view/__init__.py,sha256=UEs107Oqb9efDbmxnfheCTQFuaukXQgICuwW3qtJi08,532
2
2
  netbox_device_view/filtersets.py,sha256=kCPEIzue5bOeyFK_Aqhpi1VQ_YQvqyDBd4dvP2UqVAU,215
3
- netbox_device_view/forms.py,sha256=rr9gVDDbP_DSQP0oOTVPWjd4Mti87tcOLDf742-y6qQ,211
3
+ netbox_device_view/forms.py,sha256=JABwFhv4zU08vSaO2C8rSdnbfuNGpeHGtGnLlY2X2wU,692
4
4
  netbox_device_view/models.py,sha256=MN6eThuBJ1bm-vsQF1zM6He5cgKpMfZeCBqHmAjuHTA,500
5
- netbox_device_view/navigation.py,sha256=VU3N-Z9xIgxtlkvcdPJym8R4rDtcJBr_Axjlk39V_os,494
5
+ netbox_device_view/navigation.py,sha256=EbmAxA0a8y47jbf8XjRQvz_xAvoTwTHI9ljvC6oaX9U,646
6
6
  netbox_device_view/tables.py,sha256=ejhKjD5fGo_tLUhTExqBhDL_TbYVe9TPnzF-ZWHqujY,351
7
7
  netbox_device_view/template_content.py,sha256=4B_aiNS6ARoAv97-I6M1-2fCSIc3UcBW0tuRhy0sDZU,1072
8
- netbox_device_view/urls.py,sha256=UhLOmfj0v4ofRnHM-bxisTnIPQ2viS8I47AyHiA20LU,839
9
- netbox_device_view/utils.py,sha256=uUPJnwYfEpM6H61Z-BkyNeQwmWm3xJY5Z9-Xe9Jp7f8,3191
10
- netbox_device_view/views.py,sha256=8OQQE-BZPM_ZXXopiRGJStdXq6eAE_tndfRVvHLkA2U,1778
8
+ netbox_device_view/urls.py,sha256=DtdIPVagp1KHwPDSlBsV_rJ16pGNi8l661RkXTq32HU,971
9
+ netbox_device_view/utils.py,sha256=k5ATGcE5T0r0yvVVcxhaTw-LQfxXVUvV56pzSDJAtSU,3170
10
+ netbox_device_view/views.py,sha256=hyz6xOt0l3l2Kh0cf-TTG84JfF810ts9_SL3SsRpbGM,2020
11
11
  netbox_device_view/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  netbox_device_view/api/serializers.py,sha256=IQEFuIh7X22MWO4jxv4MctZQxln-DgH2eo-0IbdvBl4,456
13
13
  netbox_device_view/api/urls.py,sha256=cHDu5GtasFztt4zt-rj-Qkjkul8_lJ4-pxHmJ8GfDvk,205
@@ -17,7 +17,7 @@ netbox_device_view/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
17
17
  netbox_device_view/static/netbox_device_view/css/device_view.css,sha256=VnvjTMPrEnUkpb_odDe6-VJKhBXZ6RuII4Ce3EnPDCc,833
18
18
  netbox_device_view/templates/netbox_device_view/deviceview.html,sha256=iYfqjTO_tvp0c7_0s7AxKmzHC_6JRxxbRahPxoTi3NQ,2893
19
19
  netbox_device_view/templates/netbox_device_view/ports.html,sha256=H-OVDZfpa-s3NB5a3ZJmrNbir001wfYfKJss8bppBgk,1716
20
- netbox_device_view-0.1.7.dist-info/METADATA,sha256=LkaZ65ldo2ebstj8kJ2qKIfCk-ELTkZqFl_20fUBf_c,3753
21
- netbox_device_view-0.1.7.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
22
- netbox_device_view-0.1.7.dist-info/top_level.txt,sha256=Cj7X6_XpLT0jnyTyX5DMqttqc8_z3uhRYCmvnXLfWOs,19
23
- netbox_device_view-0.1.7.dist-info/RECORD,,
20
+ netbox_device_view-0.1.9.dist-info/METADATA,sha256=YTiE4aJXf39jxgFQ-9lwm7eP8r4_Yb9LpHb3VRMkQOM,3898
21
+ netbox_device_view-0.1.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
+ netbox_device_view-0.1.9.dist-info/top_level.txt,sha256=Cj7X6_XpLT0jnyTyX5DMqttqc8_z3uhRYCmvnXLfWOs,19
23
+ netbox_device_view-0.1.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5