Skip to content

Clarify requirements for module and class naming #15967

Open
netbox-community/netbox-plugin-tutorial
#35
@peteeckel

Description

@peteeckel

Change Type

Addition

Area

Plugins

Proposed Changes

I'd like to suggest adding a clarification to the NetBox plugin developer documentation, specifically the section about filtersets.

As I learned the hard way, there is a strong requirement for the filtersets of a plugin to be defined in the module filtersets, and for the filterset class for an object named, e.g. MyObject to be named MyObjectFilterSet.

While this initially isn't obvious and filtersets not following this requirement will appear to work at first, there are some issues lurking if this requirement isn't satisfied. One of the issues is that the NetBox test suite for filtersets will fail if the naming isn't exactly like described above, I found today that selectors in model select fields will fail (silently, unless error mails are enabled) in that case. There are some more issues as well.

While all examples and the plugin tutorial are compliant, an explicit mention of the strict requirement to use that naming would be useful. I've seen a couple of plugins (including the original NetBox DNS when I started working on it) that don't, so it doesn't seem to be obvious, and just today there was another help request in the netbox-plugin-development Slack channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: documentationA change or addition to the documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions