mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#9653: Cleanup
This commit is contained in:
@ -21,6 +21,10 @@ The model number assigned to this device type by its manufacturer. Must be uniqu
|
|||||||
|
|
||||||
A unique URL-friendly representation of the model identifier. (This value can be used for filtering.)
|
A unique URL-friendly representation of the model identifier. (This value can be used for filtering.)
|
||||||
|
|
||||||
|
### Default Platform
|
||||||
|
|
||||||
|
If defined, devices instantiated from this type will automatically inherit the selected platform. (This assignment can be changed after the device has been created.)
|
||||||
|
|
||||||
### Part Number
|
### Part Number
|
||||||
|
|
||||||
An alternative part number to uniquely identify the device type.
|
An alternative part number to uniquely identify the device type.
|
||||||
|
@ -280,7 +280,7 @@ class ManufacturerViewSet(NetBoxModelViewSet):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class DeviceTypeViewSet(NetBoxModelViewSet):
|
class DeviceTypeViewSet(NetBoxModelViewSet):
|
||||||
queryset = DeviceType.objects.prefetch_related('manufacturer', 'tags').annotate(
|
queryset = DeviceType.objects.prefetch_related('manufacturer', 'default_platform', 'tags').annotate(
|
||||||
device_count=count_related(Device, 'device_type')
|
device_count=count_related(Device, 'device_type')
|
||||||
)
|
)
|
||||||
serializer_class = serializers.DeviceTypeSerializer
|
serializer_class = serializers.DeviceTypeSerializer
|
||||||
|
@ -280,12 +280,14 @@ class ManufacturerImportForm(NetBoxModelImportForm):
|
|||||||
class DeviceTypeImportForm(NetBoxModelImportForm):
|
class DeviceTypeImportForm(NetBoxModelImportForm):
|
||||||
manufacturer = forms.ModelChoiceField(
|
manufacturer = forms.ModelChoiceField(
|
||||||
queryset=Manufacturer.objects.all(),
|
queryset=Manufacturer.objects.all(),
|
||||||
to_field_name='name'
|
to_field_name='name',
|
||||||
|
help_text=_('The manufacturer which produces this device type')
|
||||||
)
|
)
|
||||||
default_platform = forms.ModelChoiceField(
|
default_platform = forms.ModelChoiceField(
|
||||||
queryset=Platform.objects.all(),
|
queryset=Platform.objects.all(),
|
||||||
to_field_name='name',
|
to_field_name='name',
|
||||||
required=False,
|
required=False,
|
||||||
|
help_text=_('The default platform for devices of this type (optional)')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -283,7 +283,7 @@ class DeviceTypeForm(NetBoxModelForm):
|
|||||||
comments = CommentField()
|
comments = CommentField()
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Device Type', ('manufacturer', 'model', 'slug', 'description', 'tags', 'default_platform')),
|
('Device Type', ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
|
||||||
('Chassis', (
|
('Chassis', (
|
||||||
'u_height', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow', 'weight', 'weight_unit',
|
'u_height', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow', 'weight', 'weight_unit',
|
||||||
)),
|
)),
|
||||||
@ -293,8 +293,9 @@ class DeviceTypeForm(NetBoxModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = DeviceType
|
model = DeviceType
|
||||||
fields = [
|
fields = [
|
||||||
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow',
|
'manufacturer', 'model', 'slug', 'default_platform', 'part_number', 'u_height', 'is_full_depth',
|
||||||
'weight', 'weight_unit', 'front_image', 'rear_image', 'description', 'comments', 'tags', 'default_platform'
|
'subdevice_role', 'airflow', 'weight', 'weight_unit', 'front_image', 'rear_image', 'description',
|
||||||
|
'comments', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'front_image': ClearableFileInput(attrs={
|
'front_image': ClearableFileInput(attrs={
|
||||||
|
Reference in New Issue
Block a user