Skip to content

Commit b7ade4a

Browse files
committed
feat(filtersets): Add object_type_id filter for Jobs
Introduce a new `object_type_id` filter to enhance filtering by object type for Jobs. Update related forms and fieldsets to incorporate the new filter for better usability and consistency. Fixes #20653
1 parent 0cf58e6 commit b7ade4a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

netbox/core/filtersets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class JobFilterSet(BaseFilterSet):
8080
method='search',
8181
label=_('Search'),
8282
)
83+
object_type_id = django_filters.ModelMultipleChoiceFilter(
84+
queryset=ObjectType.objects.with_feature('jobs'),
85+
)
8386
object_type = ContentTypeFilter()
8487
created = django_filters.DateTimeFilter()
8588
created__before = django_filters.DateTimeFilter(

netbox/core/forms/filtersets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ class JobFilterForm(SavedFiltersMixin, FilterForm):
7070
model = Job
7171
fieldsets = (
7272
FieldSet('q', 'filter_id'),
73-
FieldSet('object_type', 'status', name=_('Attributes')),
73+
FieldSet('object_type_id', 'status', name=_('Attributes')),
7474
FieldSet(
7575
'created__before', 'created__after', 'scheduled__before', 'scheduled__after', 'started__before',
7676
'started__after', 'completed__before', 'completed__after', 'user', name=_('Creation')
7777
),
7878
)
79-
object_type = ContentTypeChoiceField(
79+
object_type_id = ContentTypeChoiceField(
8080
label=_('Object Type'),
8181
queryset=ObjectType.objects.with_feature('jobs'),
8282
required=False,

0 commit comments

Comments
 (0)