Advanced filter selectors are unavailable in plugins #11934

Closed
opened 2025-12-29 21:51:40 +01:00 by adam · 5 comments
Owner

Originally created by @peteeckel on GitHub (Dec 17, 2025).

NetBox Edition

NetBox Community

NetBox Version

v4.5.0b1

Python Version

3.12

Steps to Reproduce

  1. Install a plugin, e.g. NetBox DNS (version 1.5.0b1 supports NetBox 4.5)
  2. Open the filter tab for any plugin model, e.g. Zone

Expected Behavior

The new, advanced filter selectors should be available for fields that support it, e.g. CharField or NumberField

Observed Behavior

There are no advanced filter selectors.

Image
Originally created by @peteeckel on GitHub (Dec 17, 2025). ### NetBox Edition NetBox Community ### NetBox Version v4.5.0b1 ### Python Version 3.12 ### Steps to Reproduce 1. Install a plugin, e.g. NetBox DNS (version 1.5.0b1 supports NetBox 4.5) 3. Open the filter tab for any plugin model, e.g. Zone ### Expected Behavior The new, advanced filter selectors should be available for fields that support it, e.g. `CharField` or `NumberField` ### Observed Behavior There are no advanced filter selectors. <img width="939" height="678" alt="Image" src="https://github.com/user-attachments/assets/5f27fee8-d6cc-440a-9640-bbea36f5c978" />
adam added the netbox label 2025-12-29 21:51:40 +01:00
adam closed this issue 2025-12-29 21:51:40 +01:00
Author
Owner

@peteeckel commented on GitHub (Dec 17, 2025):

The filterset forms for the plugin models inherit from NetBoxModelFilterSetForm :

class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
    model = Zone

    fieldsets = (
        FieldSet(
...

Since this makes them also inherit from FilterModifierMixin, the filter modifiers should be visible, but apparently they are not.

@peteeckel commented on GitHub (Dec 17, 2025): The filterset forms for the plugin models inherit from `NetBoxModelFilterSetForm `: ```python class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): model = Zone fieldsets = ( FieldSet( ... ``` Since this makes them also inherit from `FilterModifierMixin`, the filter modifiers should be visible, but apparently they are not.
Author
Owner

@jeremystretch commented on GitHub (Dec 17, 2025):

We intentionally have not automatically included this functionality for plugin filters for two reasons:

  1. This is a newly implemented feature being assessed in core that needs time to mature before we commit to a public API for it.
  2. We cannot reasonably guarantee that enabling this behavior by default will not introduce breakage in a plugin.

Once the implementation has been proven and settled in core, we intend to add it to the plugin API in a future release (likely NetBox v4.6) as is typical for such features.

If you really want to enable it in a plugin despite the risks, you can see the necessary changes in PR #20747: The functionality is enabled when a filterset is registered via register_filterset(). But as I said this is still unsupported functionality until documented as part of the plugins API.

@jeremystretch commented on GitHub (Dec 17, 2025): We intentionally have not automatically included this functionality for plugin filters for two reasons: 1. This is a newly implemented feature being assessed in core that needs time to mature before we commit to a public API for it. 2. We cannot reasonably guarantee that enabling this behavior by default will not introduce breakage in a plugin. Once the implementation has been proven and settled in core, we intend to add it to the plugin API in a future release (likely NetBox v4.6) as is typical for such features. If you _really_ want to enable it in a plugin despite the risks, you can see the necessary changes in PR #20747: The functionality is enabled when a filterset is registered via `register_filterset()`. But as I said this is still unsupported functionality until documented as part of the plugins API.
Author
Owner

@peteeckel commented on GitHub (Dec 17, 2025):

Found the solution:

from utilities.filtersets import register_filterset

@register_filterset
class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
    model = Zone

    fieldsets = (
        FieldSet(
...

does the trick :-)

@peteeckel commented on GitHub (Dec 17, 2025): Found the solution: ```python from utilities.filtersets import register_filterset @register_filterset class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): model = Zone fieldsets = ( FieldSet( ... ``` does the trick :-)
Author
Owner

@peteeckel commented on GitHub (Dec 17, 2025):

OK, apparently our replies crossed ... I'll experiment with it for a while and then decide whether and when to enable it. It's a great feature, though, and solves many issues!

@peteeckel commented on GitHub (Dec 17, 2025): OK, apparently our replies crossed ... I'll experiment with it for a while and then decide whether and when to enable it. It's a great feature, though, and solves many issues!
Author
Owner

@jeremystretch commented on GitHub (Dec 17, 2025):

FYI I've just submitted FR #21001 to track this.

@jeremystretch commented on GitHub (Dec 17, 2025): FYI I've just submitted FR #21001 to track this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11934