Skip to content

Conversation

@renatoalmeidaoliveira
Copy link
Contributor

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

Since ObjectChangeFilterForm doesn't inherid from NetBoxModelFilterSetForm the filter_id field doesn't get updated

Changes:

  • Add __init__ method to ObjectChangeFilterForm, and setup filter_id query_params

@renatoalmeidaoliveira
Copy link
Contributor Author

That issue also affects:
Config Contexts
Config Templates
Custom Fields
Custom Field Choice Sets
Custom Links
Export Templates
Saved Filters
Image Attachments
Jobs
Notification Groups

@renatoalmeidaoliveira
Copy link
Contributor Author

The current solution, solves the issue only for ChangeLog as reported in the issue.
For a broaden solution, IMO the best approach is change the SavedFiltersMixin adding a __init__ block that setups the object_type_id query_param in the filter_id widget and remove that block from NetBoxModelFilterSetForm
The solution also requires to add a model attribute for every FilterForm that doesn't have it already, like: JobFilterForm

@bctiemann
Copy link
Contributor

@renatoalmeidaoliveira I think you're right, this functionality should go into SavedFiltersMixin. I also see what you mean about the JobFilterForm and other similar forms -- let's go ahead and add those model attributes and make sure everything still works as expected.

@jeremystretch
Copy link
Member

Found a couple more forms that need to have model declared:

  • ConfigRevisionFilterForm
  • JobFilterForm

I can knock these out real quick.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremystretch jeremystretch merged commit 7794b67 into netbox-community:main Feb 6, 2025
3 checks passed
bctiemann pushed a commit that referenced this pull request Mar 6, 2025
…gardless of defined object type (#18551)

* Setup ObjectChangeFilterForm __init__ to add query_param to filter_id

* code lint, move __init__ to end of class

* Move filter_id widget setup to SavedFiltersMixin, and add model attributes to Models FilterForms

* Add missing model declarations for filter forms

---------

Co-authored-by: Jeremy Stretch <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All saved filters showing up for Change Log table, regardless of defined object type

3 participants