|
|
@@ -11,7 +11,7 @@ from extras.utils import FeatureQuery
|
|
|
from netbox.forms.base import NetBoxModelFilterSetForm
|
|
|
from tenancy.models import Tenant, TenantGroup
|
|
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
|
|
-from utilities.forms.fields import ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, TagFilterField
|
|
|
+from utilities.forms.fields import ContentTypeChoiceField, ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, TagFilterField
|
|
|
from utilities.forms.widgets import APISelectMultiple, DateTimePicker
|
|
|
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
|
|
from .mixins import SavedFiltersMixin
|
|
|
@@ -22,6 +22,7 @@ __all__ = (
|
|
|
'CustomFieldFilterForm',
|
|
|
'CustomLinkFilterForm',
|
|
|
'ExportTemplateFilterForm',
|
|
|
+ 'ImageAttachmentFilterForm',
|
|
|
'JournalEntryFilterForm',
|
|
|
'LocalConfigContextFilterForm',
|
|
|
'ObjectChangeFilterForm',
|
|
|
@@ -137,6 +138,20 @@ class ExportTemplateFilterForm(SavedFiltersMixin, FilterForm):
|
|
|
)
|
|
|
|
|
|
|
|
|
+class ImageAttachmentFilterForm(SavedFiltersMixin, FilterForm):
|
|
|
+ fieldsets = (
|
|
|
+ (None, ('q', 'filter_id')),
|
|
|
+ ('Attributes', ('content_type_id', 'name',)),
|
|
|
+ )
|
|
|
+ content_type_id = ContentTypeChoiceField(
|
|
|
+ queryset=ContentType.objects.filter(FeatureQuery('custom_fields').get_query()),
|
|
|
+ required=False
|
|
|
+ )
|
|
|
+ name = forms.CharField(
|
|
|
+ required=False
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
class SavedFilterFilterForm(SavedFiltersMixin, FilterForm):
|
|
|
fieldsets = (
|
|
|
(None, ('q', 'filter_id')),
|