fix: graceful fallback for extras.managers import (NetBox <4.5.5 compat)#49
Merged
DenDanskeMine merged 3 commits intoMay 22, 2026
Conversation
NetBoxTaggableManager was introduced in extras.managers in NetBox 4.5.5 (commit b5bd890, Mar 9 2026). Users on NetBox 4.5.3 or 4.5.4 get a ModuleNotFoundError on startup. Changes: - Wrap the extras.managers import in a try/except so the plugin loads on any NetBox 4.5.x version - Replace inline ordering= + manager= kwargs with **_TAGGABLE_MANAGER_KWARGS across all TaggableManager definitions - Add explicit tags field to FloorPlan with related_name='netbox_map_floorplan_set' to prevent Tag.floorplan_set reverse accessor clash when netbox-floorplan-plugin is also installed Tested on NetBox 4.5.3 with netbox-floorplan-plugin also active.
Owner
|
Thanks! Both fixes are correct. Two things before I merge:
Otherwise good to go :) |
- Add **_TAGGABLE_MANAGER_KWARGS to FloorPlan.tags for consistency with all other TaggableManager definitions in the file - Add migration 0024 to record the FloorPlan.tags related_name state change (metadata-only, uses SeparateDatabaseAndState matching the pattern established in 0023)
Contributor
Author
Contributor
Author
|
how it looks now? |
Owner
|
Looks good! Ci also successful! I will have a look at it when I get home but I think this is ready to merge - Amazing work @berlikm |
Owner
|
Thanks @berlikm! Tested locally on NetBox 4.6.1 with both plugins enabled:
Merging — this addresses #60. Will be included in the next release alongside a few more fixes. |
10 tasks
DenDanskeMine
added a commit
that referenced
this pull request
May 23, 2026
* fix: hide patch panels (#66) + plugin tab URLs (#62) + neighbour walk #66 Topology "Hide patch panels" toggle now uses the real Front↔Rear PortMapping (exposed via new passthrough_pairs field on each device node) instead of a fragile role-slug substring check. Properly chains edges through patch panels in series and colors the synthetic edges by the real endpoint port speeds (matching speeds → speed color, mismatch → orange warning). #62 netbox-attachments / netbox-contract (and any other plugin that uses register_model_view to add tabs) now show up on netbox-map detail pages. Root cause: urls.py used explicit path() entries without include(get_model_urls(...)), so URLs registered by other plugins were never wired up. Adding the include() at the top of urlpatterns hooks them all in. Bonus: "Add connected devices" right-click now also pulls intermediate devices on the cable trace (typically patch panels) so cables don't go missing when the far endpoint is added but the patch panel isn't. Closes #66 Closes #62 * feat: batch 2 — small QoL features #52 Auto-suggest grid width/height from the chosen background image dimensions on the FloorPlan add/edit form (pure client-side; reads naturalWidth/height of the picked file and divides by tile_size, recomputing live when tile size changes; manual override still works). #53 Multi-site selection in Topology view — Site filter is now a multi-select that accepts both repeated ?site_id=… and the comma- separated form for backwards compatibility with saved views. #64 Filter Site Map sites by tag — new TagFilterField dropdown on the Site Map filter form, listing tags actually used on Site. #65 Site Map: load empty by default — new MapSettings boolean. Recommended for instances with thousands of sites: starts blank and only renders sites once a region/group/tenant/tag/device-role filter is applied. Closes #52 Closes #53 Closes #64 Closes #65 * feat: batch 3 — bigger features (#61, #54, #63) #61 Toolbar button to hide ports not connected within the current filtered view. Pure renderer-side filter: each device card collapses to only show ports whose remote endpoint is also visible. State persists in saved views. #54 Geocode unplaced sites from physical_address via Nominatim. New crosshair-GPS button on each unplaced-site chip in the Site Map editor; no new server-side dependency — uses the same OpenStreetMap provider already used for tiles. Handles ambiguous / missing results gracefully. #63 Three-in-one: • Switch and UPS added as built-in tile types • New Settings → Tile Types tab with TWO independent lists (Floor Plan toolbar vs Site Map create-chip tray). Fresh installs hide FTTH/fiber types by default plus floor-plan-structural types (column/wall/aisle/empty/reserved) on the Site Map. Existing tiles of hidden types still render normally — only the editor chip is hidden, so nothing breaks if a type is in use. A small +N hint appears next to the chip strip and deep-links into the settings. • Icon picker for Custom Marker Types: searches the entire MDI catalog (~7000 icons, parsed at runtime from the loaded stylesheet, zero new bytes shipped) with a live preview chip and curated quick-pick set. • Icon color option (Auto / Light / Dark) on Custom Marker Types — Auto picks light vs dark from the background luma. Honored everywhere: Site Map markers, drag ghosts, sidebar dots, Create chips, Floor Plan tiles. Plus an About tab in Settings with version, license, source/docs/issues links and a compatibility matrix. Plus a tighter floor-plan tile look (gap 2→1, radius 4→2). Plus left-sidebar menu reorganised: Maps, Catalogs, Applications (Beta), Configuration. Closes #61 Closes #54 Closes #63 * chore: bump version to 0.12.0 CHANGELOG entry summarises every fix/feature in the v0.12.0 milestone: #52, #53, #54, #60 (via PR #49 from @berlikm), #61, #62, #63, #64, #65, #66. Compatibility matrix updated: 0.12.x now formally lists NetBox 4.5+ and 4.6+ (tested against 4.5.9 and 4.6.1). * feat: PDF background image support (#67) Floor plans now accept PDF uploads alongside PNG / JPEG / GIF / WEBP. PDFs are stored as-is and rendered to canvas in the browser via PDF.js at 3x the world resolution, so they stay crisp when the user zooms in (no blurriness from a pre-rasterized PNG). - models: ImageField → FileField on FloorPlan.background_image so non-image files can be uploaded - forms: clean_background_image() validates the extension only; bytes go straight to FileStorage with no server-side processing - new endpoint api/pdf-dimensions/ returns the PDF page-1 natural pixel dimensions so the grid auto-suggest can fire for PDFs the same way it does for raster images (uses pypdfium2 — pure-Python wheel, Apache-2.0 + BSD, no system packages) - new form field "Auto-fill grid from background" (defaults ON for new plans, OFF when editing) so existing grid dims aren't silently overwritten on file change - frontend: PDF.js (~340KB main + 1.4MB worker) lives under static/netbox_map/js/pdfjs/ and is lazy-loaded only when the user actually has a PDF background — plans with raster or no background pay nothing for the feature - floorplan_renderer.loadBackgroundImage() detects .pdf URLs and routes them through PDF.js; the rendered offscreen canvas is used as bgImg, so the rest of the rendering pipeline doesn't change (drawImage works on both canvas and image sources) - migration 0031 alters the field type (metadata-only — same VARCHAR column underneath, existing rasters keep working unchanged) Closes #67 * style: ruff fixes (line length, semicolons, comma spacing) * ci: matrix test across the full supported NetBox range Run the test job once per NetBox minor line we claim compatibility with (currently v4.5.10 + v4.6.1). fail-fast: false so a regression on one version doesn't mask another. * test: add icon_foreground to CustomMarkerType form_data ViewTestCases generate POST data from form_data; the new icon_foreground field added in this release wasn't in the fixture, so create+edit POSTs returned the form back (200) instead of redirecting on success (302).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
NetBoxTaggableManagerwas introduced inextras/managers.pyin NetBox 4.5.5 (commit b5bd890, Mar 9 2026). Users on NetBox 4.5.3 or 4.5.4 get the following error on startup:Additionally, if
netbox-floorplan-pluginis also installed, a second error occurs:Changes
extras.managersimport in atry/except ImportErrorso the plugin loads gracefully on any NetBox 4.5.x version (with the performance optimization on 4.5.5+, without it on older versions)ordering=+manager=kwargs with**_TAGGABLE_MANAGER_KWARGSacross all 5TaggableManagerdefinitionstagsfield override toFloorPlanwithrelated_name='netbox_map_floorplan_set'to prevent reverse accessor clash withnetbox-floorplan-pluginTested on
netbox-floorplan-pluginalso installed - migrations and system checks pass