Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #18013 - All saved filters showing up for Change Log table, regardless of defined object type #18551

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions netbox/core/forms/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ class ObjectChangeFilterForm(SavedFiltersMixin, FilterForm):
label=_('Object Type'),
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# Limit saved filters to those applicable to the form's model
object_type = ObjectType.objects.get_for_model(self.model)
self.fields['filter_id'].widget.add_query_params({
'object_type_id': object_type.pk,
})


class ConfigRevisionFilterForm(SavedFiltersMixin, FilterForm):
fieldsets = (
Expand Down