mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added cable filter form
This commit is contained in:
@@ -17,10 +17,11 @@ from tenancy.forms import TenancyForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms import (
|
||||
AnnotatedMultipleChoiceField, APISelect, add_blank_choice, ArrayFieldSelectMultiple, BootstrapMixin, BulkEditForm,
|
||||
BulkEditNullBooleanSelect, ChainedFieldsMixin, ChainedModelChoiceField, CommentField, ComponentForm,
|
||||
ConfirmationForm, CSVChoiceField, ExpandableNameField, FilterChoiceField, FilterTreeNodeMultipleChoiceField,
|
||||
FlexibleModelChoiceField, JSONField, Livesearch, SelectWithDisabled, SelectWithPK, SmallTextarea, SlugField,
|
||||
ContentTypeSelect
|
||||
BulkEditNullBooleanSelect, ChainedFieldsMixin, ChainedModelChoiceField, ColorSelect, CommentField, ComponentForm,
|
||||
ConfirmationForm, ContentTypeSelect, CSVChoiceField, ExpandableNameField, FilterChoiceField,
|
||||
FilterTreeNodeMultipleChoiceField, FlexibleModelChoiceField, JSONField, Livesearch, SelectWithPK, SmallTextarea,
|
||||
SlugField, COLOR_CHOICES,
|
||||
|
||||
)
|
||||
from virtualization.models import Cluster
|
||||
from .constants import *
|
||||
@@ -2212,6 +2213,22 @@ class CableForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelForm):
|
||||
)
|
||||
|
||||
|
||||
class CableFilterForm(BootstrapMixin, forms.Form):
|
||||
model = Cable
|
||||
q = forms.CharField(required=False, label='Search')
|
||||
type = AnnotatedMultipleChoiceField(
|
||||
choices=CABLE_TYPE_CHOICES,
|
||||
annotate=Cable.objects.all(),
|
||||
annotate_field='type',
|
||||
required=False
|
||||
)
|
||||
color = forms.ChoiceField(
|
||||
choices=add_blank_choice(COLOR_CHOICES),
|
||||
widget=ColorSelect(),
|
||||
required=False
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Device bays
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user