|
11 | 11 | from netbox.forms.base import NetBoxModelFilterSetForm
|
12 | 12 | from tenancy.models import Tenant, TenantGroup
|
13 | 13 | from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, FilterForm, add_blank_choice
|
14 |
| -from utilities.forms.fields import ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, TagFilterField |
| 14 | +from utilities.forms.fields import ContentTypeChoiceField, ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, TagFilterField |
15 | 15 | from utilities.forms.widgets import APISelectMultiple, DateTimePicker
|
16 | 16 | from virtualization.models import Cluster, ClusterGroup, ClusterType
|
17 | 17 | from .mixins import SavedFiltersMixin
|
|
22 | 22 | 'CustomFieldFilterForm',
|
23 | 23 | 'CustomLinkFilterForm',
|
24 | 24 | 'ExportTemplateFilterForm',
|
| 25 | + 'ImageAttachmentFilterForm', |
25 | 26 | 'JournalEntryFilterForm',
|
26 | 27 | 'LocalConfigContextFilterForm',
|
27 | 28 | 'ObjectChangeFilterForm',
|
@@ -137,6 +138,22 @@ class ExportTemplateFilterForm(SavedFiltersMixin, FilterForm):
|
137 | 138 | )
|
138 | 139 |
|
139 | 140 |
|
| 141 | +class ImageAttachmentFilterForm(SavedFiltersMixin, FilterForm): |
| 142 | + fieldsets = ( |
| 143 | + (None, ('q', 'filter_id')), |
| 144 | + ('Attributes', ('content_type', 'name',)), |
| 145 | + ) |
| 146 | + |
| 147 | + content_type = ContentTypeChoiceField( |
| 148 | + queryset=ContentType.objects.filter(FeatureQuery('custom_fields').get_query()), |
| 149 | + required=False |
| 150 | + ) |
| 151 | + |
| 152 | + name = forms.CharField( |
| 153 | + required=False |
| 154 | + ) |
| 155 | + |
| 156 | + |
140 | 157 | class SavedFilterFilterForm(SavedFiltersMixin, FilterForm):
|
141 | 158 | fieldsets = (
|
142 | 159 | (None, ('q', 'filter_id')),
|
|
0 commit comments