1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#7846: Show assigned component (if any) when creating inventory item

This commit is contained in:
jeremystretch
2021-12-28 14:06:20 -05:00
parent e9910d1fe2
commit 21356b487a
5 changed files with 44 additions and 7 deletions

View File

@ -1377,10 +1377,11 @@ class InventoryItemForm(CustomFieldModelForm):
queryset=ContentType.objects.all(),
limit_choices_to=MODULAR_COMPONENT_MODELS,
required=False,
widget=StaticSelect
widget=forms.HiddenInput
)
component_id = forms.IntegerField(
required=False
required=False,
widget=forms.HiddenInput
)
tags = DynamicModelMultipleChoiceField(
queryset=Tag.objects.all(),
@ -1396,7 +1397,6 @@ class InventoryItemForm(CustomFieldModelForm):
fieldsets = (
('Inventory Item', ('device', 'parent', 'name', 'label', 'role', 'description', 'tags')),
('Hardware', ('manufacturer', 'part_id', 'serial', 'asset_tag')),
('Component', ('component_type', 'component_id')),
)
widgets = {
'device': forms.HiddenInput(),