Skip to main content

netbox-tenant-switcher icon

NetBox Tenant Switcher

Pick a tenant once, and every list in NetBox shows only that tenant's objects.

netbox-tenant-switcher adds a searchable tenant selector to the top navigation bar — rendered inside the field, just like NetBox's global search box. Choose a tenant and, as you move between sections (Devices, Prefixes, VLANs, Sites, Racks, …), each list view is automatically scoped to that tenant. Choose "— All tenants —" to clear the scope.

It's ideal for MSPs, multi-customer labs, and anyone who spends the day working inside one tenant at a time and doesn't want to add a tenant filter on every page.

Screenshots

Tenant selector in the navbar The tenant selector sits in the top navigation bar, rendered inside the field like NetBox's global search.

Tenant dropdown with per-tenant checkboxes and instant search Open the dropdown to multi-select tenants and type to filter instantly; selected tenants float to the top.

Selected tenants shown in the field Chosen tenants are listed comma-separated in the field and persist across the session.

Device list scoped to the selected tenants Every list view (Devices, Prefixes, VLANs, …) is automatically scoped to the selected tenants.

Features

  • Multi-select tenant switcher in the navbar with a checkbox per tenant and instant client-side search — no external JS dependencies.
  • Selected tenants are shown comma-separated in the field, truncated with an ellipsis to fit the header; the field width adapts to the viewport and never overlaps the global search box.
  • Selected tenants float to the top when the dropdown opens; the list is ordered by name.
  • Selection persists in the session; no models, no migrations.
  • Automatically scopes every object list view whose filterset supports a tenant filter, by appending ?tenant_id=<id> (once per selected tenant, so multiple tenants are OR-combined).
  • Non-tenancy models (Manufacturers, Device Types, …) and detail views are left untouched.
  • Permission-aware: the dropdown only lists tenants the user may view, and a tenant can't be selected unless the user has view access to it.
  • Only ever narrows results — NetBox object permissions still apply on top.

Compatibility

Plugin version NetBox version Python
1.0.x 4.6 3.10 – 3.12

Developed and verified against NetBox 4.6. It uses only stable plugin APIs (PluginTemplateExtension.navbar() / head(), plugin middleware) and is expected to work on nearby 4.x releases; the CI matrix in .github/workflows/ci.yml is where additional versions should be validated.

Dependencies

  • NetBox ≥ 4.6 (provides Django, Tom Select, and the tenancy models).
  • No additional Python packages, external services, or other plugins required.

Installation

  1. Install the package into NetBox's Python environment:

    source /opt/netbox/venv/bin/activate
    pip install netbox-tenant-switcher
    
  2. Enable it in configuration.py:

    PLUGINS = [
        "netbox_tenant_switcher",
    ]
    
  3. Restart NetBox:

    sudo systemctl restart netbox netbox-rq
    

No database migrations are required.

Docker (netbox-docker)

See deploy/ for a ready-to-use Dockerfile-Plugins, docker-compose.override.yml, and plugins.py. In short: drop the project under plugins/plugin-src/, add the plugin to configuration/plugins.py, then:

docker compose build netbox
docker compose up -d

Configuration

None. The plugin works out of the box; there are no PLUGINS_CONFIG settings.

How it works

  • Navbar widget (template_content.py) — a PluginTemplateExtension renders a small, dependency-free multi-select (checkbox list + instant search) via the navbar() hook; styling is injected through head(). It stays in one line with the selected tenants comma-separated and ellipsis-truncated.

  • Set endpoint (views.py) — GET /plugins/tenant-switcher/set/?tenant=<id>&tenant=<id>&next=<path> stores the chosen tenants in the session and redirects back. next is validated against the current host (no open redirects) and every tenant id is checked against the user's view permission.

  • Middleware (middleware.py) — for ObjectListView pages whose filterset exposes a tenant_id filter, it appends one ?tenant_id=<id> per selected tenant when no explicit tenant filter is already present.

    Design note: scoping is done by URL rewriting rather than by patching every queryset. This keeps the plugin decoupled from core views, applies uniformly across DCIM/IPAM/etc., and leaves the applied filter visible and removable in the UI.

Support

Contributing

PRs welcome. Run the test suite the way NetBox does — see .github/workflows/ci.yml (checkout NetBox, install the plugin, then python netbox/manage.py test netbox_tenant_switcher).

License

Apache-2.0 — matching NetBox itself. The icon in docs/img/ is released under CC BY 4.0.

Metadata

Release files for netbox-tenant-switcher 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netbox-tenant-switcher 1.0.1
File Size Uploaded
netbox_tenant_switcher-1.0.1.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for netbox-tenant-switcher 1.0.1
File Interpreter ABI Platform
netbox_tenant_switcher-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 37.4 kB

Release files / netbox_tenant_switcher-1.0.1.tar.gz

Download URL netbox_tenant_switcher-1.0.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4f82b55d84983dcf1721b96f2550640d637cecb71ef4a3ff793a4f411b277dc7
BLAKE2b-256 checksum
How to use checksums
d6f419e11471dd585f38f34c06c64c80791eaae81cdaa3553643114eeb7141d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / netbox_tenant_switcher-1.0.1-py3-none-any.whl

Download URL netbox_tenant_switcher-1.0.1-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7f8899d75a908a6e5e9d7e9817e98240a1a60e4b69c15b3ea756543c5658d5b
BLAKE2b-256 checksum
How to use checksums
08d488de796614f6b30f0c5747bb7a0f870476af15642765c3671b3af0eb70ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page