Skip to content

Commit 9ce29f9

Browse files
committed
#9653: Cleanup
1 parent ecb8f15 commit 9ce29f9

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

docs/models/dcim/devicetype.md

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ The model number assigned to this device type by its manufacturer. Must be uniqu
2121

2222
A unique URL-friendly representation of the model identifier. (This value can be used for filtering.)
2323

24+
### Default Platform
25+
26+
If defined, devices instantiated from this type will automatically inherit the selected platform. (This assignment can be changed after the device has been created.)
27+
2428
### Part Number
2529

2630
An alternative part number to uniquely identify the device type.

netbox/dcim/api/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class ManufacturerViewSet(NetBoxModelViewSet):
280280
#
281281

282282
class DeviceTypeViewSet(NetBoxModelViewSet):
283-
queryset = DeviceType.objects.prefetch_related('manufacturer', 'tags').annotate(
283+
queryset = DeviceType.objects.prefetch_related('manufacturer', 'default_platform', 'tags').annotate(
284284
device_count=count_related(Device, 'device_type')
285285
)
286286
serializer_class = serializers.DeviceTypeSerializer

netbox/dcim/forms/bulk_import.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,14 @@ class Meta:
280280
class DeviceTypeImportForm(NetBoxModelImportForm):
281281
manufacturer = forms.ModelChoiceField(
282282
queryset=Manufacturer.objects.all(),
283-
to_field_name='name'
283+
to_field_name='name',
284+
help_text=_('The manufacturer which produces this device type')
284285
)
285286
default_platform = forms.ModelChoiceField(
286287
queryset=Platform.objects.all(),
287288
to_field_name='name',
288289
required=False,
290+
help_text=_('The default platform for devices of this type (optional)')
289291
)
290292

291293
class Meta:

netbox/dcim/forms/model_forms.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class DeviceTypeForm(NetBoxModelForm):
283283
comments = CommentField()
284284

285285
fieldsets = (
286-
('Device Type', ('manufacturer', 'model', 'slug', 'description', 'tags', 'default_platform')),
286+
('Device Type', ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
287287
('Chassis', (
288288
'u_height', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow', 'weight', 'weight_unit',
289289
)),
@@ -293,8 +293,9 @@ class DeviceTypeForm(NetBoxModelForm):
293293
class Meta:
294294
model = DeviceType
295295
fields = [
296-
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow',
297-
'weight', 'weight_unit', 'front_image', 'rear_image', 'description', 'comments', 'tags', 'default_platform'
296+
'manufacturer', 'model', 'slug', 'default_platform', 'part_number', 'u_height', 'is_full_depth',
297+
'subdevice_role', 'airflow', 'weight', 'weight_unit', 'front_image', 'rear_image', 'description',
298+
'comments', 'tags',
298299
]
299300
widgets = {
300301
'front_image': ClearableFileInput(attrs={

0 commit comments

Comments
 (0)