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

Fixes #9657: Fix filtering for custom fields and webhooks in the UI

This commit is contained in:
jeremystretch
2022-07-08 14:59:16 -04:00
parent 55b3e4eeb3
commit a40ab9ffb1
4 changed files with 85 additions and 10 deletions

View File

@@ -32,12 +32,13 @@ __all__ = (
class CustomFieldFilterForm(FilterForm):
fieldsets = (
(None, ('q',)),
('Attributes', ('type', 'content_types', 'weight', 'required')),
('Attributes', ('type', 'content_type_id', 'weight', 'required')),
)
content_types = ContentTypeMultipleChoiceField(
content_type_id = ContentTypeMultipleChoiceField(
queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_fields'),
required=False
required=False,
label='Object type'
)
type = MultipleChoiceField(
choices=CustomFieldTypeChoices,
@@ -110,13 +111,14 @@ class ExportTemplateFilterForm(FilterForm):
class WebhookFilterForm(FilterForm):
fieldsets = (
(None, ('q',)),
('Attributes', ('content_types', 'http_method', 'enabled')),
('Attributes', ('content_type_id', 'http_method', 'enabled')),
('Events', ('type_create', 'type_update', 'type_delete')),
)
content_types = ContentTypeMultipleChoiceField(
content_type_id = ContentTypeMultipleChoiceField(
queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('webhooks'),
required=False
required=False,
label='Object type'
)
http_method = MultipleChoiceField(
choices=WebhookHttpMethodChoices,