Compare commits

...

279 Commits

Author SHA1 Message Date
Daniel Sheppard
f0f6c7a6a0 Fixes: #19275 - Make type choice for interfaces non-required 2025-04-22 16:33:52 -05:00
Jeremy Stretch
d2e74e9d50 Release v4.2.8 2025-04-22 15:44:02 -04:00
bctiemann
02571130b2 Merge pull request #19259 from netbox-community/18961-vc-create-ignore-vc-members
Fixes #18961: Virtual chassis form should exclude members of other VCs when adding members
2025-04-22 14:36:12 -04:00
Jeremy Stretch
46a3ce2559 Fixes #19268: Restore editing conflict protection for several object forms (#19271) 2025-04-22 11:07:03 -07:00
Jeremy Stretch
1850c21714 Fixes #19265: Strip linebreaks from URLs for logging 2025-04-22 12:48:57 -04:00
Jeremy Stretch
13ddd5fd20 Fixes #19230: Allow label reuse when creating multiple components from a pattern (#19261) 2025-04-22 08:55:31 -07:00
Jeremy Stretch
60cdf89cad Fixes #19166: Fix bulk import support for base_choices (#19257) 2025-04-22 08:29:00 -07:00
Jeremy Stretch
77bfc40579 Closes #17136: Add read-only database support to the upgrade script (#19247) 2025-04-22 07:42:54 -07:00
Jeremy Stretch
2f8936d493 Fixes #18961: Virtual chassis form should exclude members of other VCs when adding members 2025-04-22 10:24:43 -04:00
bctiemann
e0b6a31504 Merge pull request #19256 from netbox-community/18959-cable-trace-terminations-ordering
Fixes #18959: Preserve ordering of terminations in cable traces
2025-04-22 10:08:13 -04:00
Jeremy Stretch
8567aa96e4 Remove obsolete comment 2025-04-22 09:42:17 -04:00
Jeremy Stretch
459c4bfd9d Fixes #18959: Preserve ordering of terminations in cable traces 2025-04-22 09:21:14 -04:00
Jeremy Stretch
918470a2bb Closes #19208: Ignore beta releases when fetching latest release tag 2025-04-22 08:18:23 -04:00
Arthur
c73cc0a36a 18500 fix check for cloning mixin 2025-04-22 08:14:32 -04:00
Renato Almeida de Oliveira Zaroubin
6b9b66aecb make INTERFACE_FHRPGROUPS use FHRPGROUPS _str_ representation 2025-04-22 08:06:24 -04:00
github-actions
b6d10ae6d8 Update source translation strings 2025-04-22 05:02:08 +00:00
Renato Almeida de Oliveira
7420c25687 Fixes: #18881 Site Groups are missing VLAN and VM related objects (#18932) 2025-04-21 09:11:01 -07:00
github-actions
248c94bd35 Update source translation strings 2025-04-16 05:02:15 +00:00
bctiemann
96cf8d14dc Merge pull request #19194 from netbox-community/17908-cable-trace-buttons
Closes #17908: Add trace buttons to terminations under cable view
2025-04-15 18:13:59 -04:00
bctiemann
2356a3c125 Merge pull request #19162 from alehaa/19040-copy-rendered-config
Fixes #19040: Add button to copy rendered config to clipboard
2025-04-15 18:00:47 -04:00
bctiemann
0d81007fdf Merge pull request #19178 from netbox-community/19139-tx-force-pull
Closes #19139: Use --force when invoking tx pull
2025-04-15 17:59:58 -04:00
atownson
c108c738ae Fixes #18669 - Populate custom field default values (#19115) 2025-04-15 13:26:03 -07:00
Martin Hauser
cac41cd093 Fixes #19196: Add Filtering by VLAN Translation Policy to Interface Filter Forms (#19199)
* feat(dcim): Add VLAN Translation Policy to Filter Form

Introduces support for VLAN Translation Policies in the Interface
Filter Form.

* feat(virtualization): Add VLAN Translation Policy to Filter Form

Introduces support for VLAN Translation Policies in the Interface
Filter Form.
2025-04-15 16:24:45 -04:00
Jeremy Stretch
27b26ec49c Fixes #19195: Language cookie should respect SESSION_COOKIE_SECURE value (#19197) 2025-04-15 13:03:33 -07:00
Jeremy Stretch
7c2776d721 Closes #19201: Include TS source with sourcemap (#19202) 2025-04-15 14:42:40 -05:00
Martin Hauser
1f93471659 Fixes #18978 - Allow filtering of Interfaces in the GUI by 802.1Q Mode (#19183)
* feat(dcim): Add VLAN mode filter to CommonInterface

Introduces a new FilterSet for VLAN mode in CommonInterfaceFilterSet.
This allows filtering interfaces based on their VLAN mode using defined
choices.

* feat(dcim): Add VLAN mode filter to Interface FilterForm

Add a field to InterfaceFilterSet to filter interfaces by 802.1Q VLAN
mode.

* feat(virtualization): Add VLAN mode filter to VMInterface

Add a field to VMInterfaceFilterSet to filter interfaces by 802.1Q VLAN
mode.

* fix(dcim): Correct mode filter parameter type in tests

Updates the `mode` filter parameter to accept a list instead of a single
value in `test_filtersets.py`. Ensures proper count assertion for
accurate test behavior.

* feat(virtualization): Add tests for VLAN mode filtering

Introduces tests to validate filtering by `mode` for VMInterface.
Ensures correct filtering for 802.1Q VLAN mode.

* refactor(virtualization): Reorganize FieldSets in FilterSets

Splits the 'Attributes' FieldSet into two distinct FieldSets for better
clarity: 'Attributes' and 'Addressing'. This improves form organization
and makes it more intuitive for users.
2025-04-15 13:47:51 -04:00
Jeremy Stretch
d3768feb31 Closes #17908: Add trace buttons to terminations under cable view 2025-04-15 11:41:00 -04:00
Jeremy Stretch
70cc7c7563 Fixes #19169: Remove horizontal padding from highlighted text (#19181) 2025-04-15 07:13:58 -07:00
Jeremy Stretch
8b091fb219 Fixes #19189: BaseScript.load_yaml() should use SafeLoader (#19190) 2025-04-15 08:58:13 -05:00
Martin Hauser
44cb1a9139 Fixes #19056 – Add Device filtering by Location slug (#19180)
* feat(dcim): Add filter by location slug for Device

Introduces a TreeNodeMultipleChoiceFilter for filtering locations by
slug. Enhances filtering flexibility in the Device model by supporting
both ID and slug lookups.

Fixes #19056

* feat(dcim): Add Device filtering by location slug in tests

Extend test cases to include filtering by location slug. Ensures the
FilterSet works correctly with slug-based queries for locations.

Fixes #19056
2025-04-15 08:22:59 -04:00
Martin Hauser
bb9b0b8f8a Fixes #18879 - Add prefix filtering by assigned VLAN Group (#19182)
* feat(ipam): Add VLAN group filters to IPAM FilterSet

Introduces filters for VLAN groups using both ID and slug fields.

* feat(ipam): Add VLAN group filter in IPAM FilterForm

Introduces a `vlan_group_id` filter to IPAM forms for filtering based on
VLAN groups.

* feat(ipam): Add VLAN group filtering to tests

Introduces tests for VLAN group filtering in FilterSets. This ensures
correct validation and behavior when filtering by VLAN group.
2025-04-15 07:59:32 -04:00
github-actions
785ad505ba Update source translation strings 2025-04-15 05:02:10 +00:00
Jeremy Stretch
8aacef60a3 Closes #19175: Remove outdated NetBox installation video (#19177) 2025-04-14 15:14:59 -05:00
Jeremy Stretch
d8fc052bbe Closes #19139: Use --force when invoking tx pull 2025-04-14 15:55:08 -04:00
Renato Almeida de Oliveira Zaroubin
1f79411878 Add GetRelatedModelsMixin to ClusterView 2025-04-14 15:39:49 -04:00
bctiemann
94d19e8f15 Remove #18095 from v4.2.5 release notes (#19165) 2025-04-14 07:26:37 -07:00
Alexander Haase
f337ef1134 Add button to copy rendered config 2025-04-13 18:02:21 +02:00
Jeremy Stretch
6ed41f6680 Fixes #18955: Include the "clear" button only for non-required dropdown fields (#18971)
* Include the 'clear' button only for non-required fields

* Apply the 'required' attribute for mandatory <select> fields

* Recompile static assets
2025-04-11 08:20:24 -04:00
github-actions
28e62d21a9 Update source translation strings 2025-04-11 05:02:06 +00:00
Jeremy Stretch
03f3f5c957 Release v4.2.7 2025-04-10 16:07:24 -04:00
Jeremy Stretch
fe7fb94e44 Revert "Fixes: #18783 Add a tag_id filter for all models which support taggin…"
This reverts commit 9a1d9365cd.
2025-04-10 15:42:26 -04:00
github-actions
82b9e4ca26 Update source translation strings 2025-04-10 05:02:11 +00:00
Jeremy Stretch
457fb977a7 Fixes #19122: Fix styling of the server error (500) page (#19126) 2025-04-09 14:57:25 -07:00
Jeremy Stretch
13c20957a6 Closes #18652: Run housekeeping GitHub actions only on the main repository (#19125) 2025-04-09 16:28:00 -05:00
Jason Novinger
30208549ba Fixes #19092: scope type selection lost when editing multiple/all objects (#19102) 2025-04-09 14:55:41 -04:00
atownson
bf286df670 Fixes #19030 - Update z-index of floating buttons (#19118)
* Increase z-index of form floating buttons

* Update netbox.css
2025-04-08 16:02:08 -05:00
Jeremy Stretch
2be257db48 Closes #19112: Configure ruff to target Python 3.10 (#19113) 2025-04-08 09:46:31 -05:00
bctiemann
2207ea1a32 Merge pull request #19046 from pheus/docs/18733-add-version-requirements-matrix
Fixes #18733: Add Dependency Version Matrix for NetBox Versions to the Upgrade Documentation
2025-04-07 14:01:54 -04:00
Martin Hauser
10e1ae8292 docs(release): Update Dependency Requirements Matrix header
Renames the "Adopt the Dependency Requirements Matrix" section to
"Update the Dependency Requirements Matrix" for clarity.
2025-04-07 17:17:26 +02:00
Martin Hauser
f8f5ab8d61 docs(release): Correct formatting in release checklist 2025-04-07 16:55:23 +02:00
github-actions
92317248a3 Update source translation strings 2025-04-05 05:02:12 +00:00
Jeremy Stretch
426e6439e3 Fixes #18553: Update site for VMs only if cluster has a site assigned (#19086) 2025-04-04 10:58:06 -07:00
Jeremy Stretch
621b29cd71 Closes #19035: Move the registration of core event types to the app config (#19088) 2025-04-04 11:18:42 -05:00
github-actions
8f5d273f08 Update source translation strings 2025-04-03 05:02:01 +00:00
Martin Hauser
45779a24a4 docs(release): Update checklist with dependency requirements
Add steps to update the dependency requirements matrix for each minor
release in the release checklist. Clarify how to document changes for
system requirements and linked installation guides.

Fixes #18733
2025-04-02 21:41:36 +02:00
Martin Hauser
f17bbe610e Fixes #19041: Call super().clean() in FrontPortCreateForm (#19051)
* fix(forms): Call super().clean() in clean methods

Adds a call to super().clean() in the clean methods of object creation
forms. This ensures base class validation logic is executed properly
before custom logic is applied.

Fixes #19041

* test(forms): Add tests for front port form validation

Introduces unit tests for validating FrontPortCreateForm behavior.
Tests include scenarios for matching and mismatched name-label pairs
to ensure proper form validation logic.

Fixes #19041

* Omit errant print statement

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-04-02 08:29:21 -04:00
bctiemann
bad820001d Merge pull request #19015 from netbox-community/18738-script-list-ignoring-script-order
Fixes #18738: Ensure ScriptList respects script_order option
2025-04-01 10:09:39 -04:00
Martin Hauser
a5106b858d docs(upgrading): Add dependency matrix for NetBox versions
Adds a dependency matrix to the upgrade guide, detailing supported
Python, PostgreSQL, and Redis versions for each NetBox release. This
helps users verify compatibility before upgrading.

Fixes #18733
2025-04-01 07:23:42 +02:00
github-actions
bbd5e9cab9 Update source translation strings 2025-04-01 05:02:06 +00:00
bctiemann
12231ad71a Merge pull request #18997 from antoinekh/18964_fix_bulk_edit_all
Fixes #18964 Select all with bulk edit only changes the currently visible objects
2025-03-31 18:36:04 -04:00
Jeremy Stretch
88ef9ecfa3 Fixes #19023: get_field_value() should respect null values in bound forms (#19024) 2025-03-31 16:34:46 -05:00
github-actions
6f78b3d0cd Update source translation strings 2025-03-29 05:02:03 +00:00
Jason Novinger
d3f42deb32 Fixes #18895: Allows VirtualCircuitTerminations as Interface connected_endpoints (#19027) 2025-03-28 08:58:09 -07:00
Jason Novinger
db4fb8f406 Fixes #18999: Allow GraphQL to represent inventory items with no set manufacturar (#19016) 2025-03-28 07:57:56 -07:00
ZPrimed
5b8eaced1a Update choices.py - add MoCA (Coaxial) 2025-03-28 08:45:04 -04:00
github-actions
ada0c7f687 Update source translation strings 2025-03-28 05:02:14 +00:00
Jeremy Stretch
b750d0dff2 Fixes #19021: Ensure consistent styling for JSON form fields (#19022) 2025-03-27 08:58:37 -05:00
Jason Novinger
e1e514251e Fixes #18965: Ensure script list run buttons respect scripts' commit_default option (#19013)
* Fixes #18965: Script list run buttons respect scripts' commit_default

* Cleanup script .Meta access in template
2025-03-27 08:39:50 -04:00
Renato Almeida de Oliveira
7d80a45bf8 Fixes: #16144 GetReturnURLMixin Support for Plugin Views (#18996)
* Add plugin support to GetReturnURLMixin

* use get_viewname instead of resolving the name
2025-03-27 08:33:09 -04:00
github-actions
09854a3d54 Update source translation strings 2025-03-27 05:02:15 +00:00
Jason Novinger
39a96ddf3a Fixes #18738: Ensure ScriptList respects script_order option 2025-03-26 15:35:06 -05:00
atownson
be26f86b62 Added advanced object selector to custom field object and multi-object inputs (#18830) 2025-03-26 10:42:45 -07:00
Jason Novinger
fd2bcda8b8 Fixes #18991: AttributeError: NoneType object has not attribute model (#19006) 2025-03-26 10:12:45 -07:00
github-actions
817d7efee3 Update source translation strings 2025-03-26 05:03:20 +00:00
Renato Almeida de Oliveira
9a1d9365cd Fixes: #18783 Add a tag_id filter for all models which support tagging (#18889) 2025-03-25 08:06:22 -07:00
Antoine Keranflec'h
ada4a4b93c fix #18964 reinsert else condition 2025-03-25 08:22:59 +00:00
github-actions
64a98fd87f Update source translation strings 2025-03-25 05:02:04 +00:00
Arthur Hanson
bd8e00a935 18904 add tags to config context table (#18938)
* 18904 add tags to config context table

* 18904 tag to correct table
2025-03-24 17:02:36 -04:00
Jeremy Stretch
af5a600583 Closes #18980: Optimize update of object data when adding/removing custom fields (#18983)
* Employ native PostgreSQL functions for updating object JSON data when adding/removing custom fields

* Optimize rename_object_data()

* remove_stale_data() should validate model class
2025-03-24 12:02:54 -05:00
github-actions
8ab73501d1 Update source translation strings 2025-03-22 05:02:10 +00:00
Renato Almeida de Oliveira
447e108d97 Fixes: #18656 Unable to import IP Address and assign to FHRP Group (#18950)
* Add fhrpgroup to IPAddressImportForm

* Change fhrpgroup accessor to name

* rename fhrpgroup to fhrp_group

* Add fhrp_group to  IPAddressTestCase csv_data
2025-03-21 16:44:10 -05:00
bctiemann
e186113cb3 Merge pull request #18986 from netbox-community/release-v4.2.6
Release v4.2.6
2025-03-21 17:17:50 -04:00
Jason Novinger
40452ead62 Cleanup release notes 2025-03-21 16:03:34 -05:00
Jason Novinger
34d80beaa2 Release v4.2.6 2025-03-21 15:49:20 -05:00
Yi
b1d014b520 Fixes #18949: Add missing GraphQL ContactsMixin in types with ContactAssignments 2025-03-21 13:00:50 -05:00
github-actions
7db0765ed2 Update source translation strings 2025-03-21 05:02:02 +00:00
Jason Novinger
b8cc2d7116 Fixes #18887: Allows VMInterface object custom field on Prefix (#18945) 2025-03-20 13:55:12 -07:00
Renato Almeida de Oliveira
d332a0c0d7 Fix sitegroup typo, VLANGroupFilterForm field didn't match between form and filterset (#18947) 2025-03-20 11:30:39 -05:00
Jason Novinger
f07e2dd4e2 Fixes #18944: Clearing widget type field no longer causes 500 error (#18946)
* Fixes #18944: Clearing widget type field no longer causes 500 error

* Address PR feedback, cleanup implementation
2025-03-20 09:12:05 -04:00
Renato Almeida de Oliveira
d7b9b09d56 Fixes: #18939 Allow ASN search by site-group (#18948)
* Add site_group and site_group_id to ASNFilterSet and ASNFilterForm

* Implement ASNTestCase site_group test case
2025-03-20 09:07:48 -04:00
github-actions
9da4cf31ab Update source translation strings 2025-03-20 05:02:02 +00:00
Renato Almeida de Oliveira
bf1a9a6e2d Fixes: #18833 Inventory Item Bulk Import - 'InventoryItemImportForm' has no field named 'component_id'. (#18874)
* Refactor InventoryItemImportForm clean method

* Add super().clean(); renamed content_type; simplified component creation

* Fix missing component_name issue

* Update netbox/dcim/forms/bulk_import.py

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-03-19 09:56:42 -04:00
bctiemann
c50b1c989d Merge pull request #18929 from netbox-community/18928-housekeeping-changelog-cleanup
Fixes #18928: Fix support for cascading deletions when cleaning up expired changelog records
2025-03-19 09:51:11 -04:00
bctiemann
79b0c0f5d6 Merge pull request #18901 from netbox-community/18872-JournalEntry-kind-required
Fixes #18872: JournalEntry `kind` is a required field
2025-03-19 09:40:55 -04:00
github-actions
43840e6a72 Update source translation strings 2025-03-19 05:02:13 +00:00
bctiemann
7c152e9234 Merge pull request #18854 from netbox-community/18782-dashboard-broken-on-notification-list-widget
Fixes #18782: Misconfigured `ObjectListWidget`s now degrade gracefully
2025-03-18 14:45:23 -04:00
Jason Novinger
d7709a2a55 Fixes #18926: Uses correct icon for base GitHub auth 2025-03-18 08:48:27 -04:00
github-actions
dce694afa9 Update source translation strings 2025-03-18 05:02:07 +00:00
Jeremy Stretch
c5801f9881 Fixes #18928: Fix support for cascading deletions when cleaning up expired changelog records 2025-03-17 14:16:55 -04:00
Jeremy Stretch
f86647dc28 Fixes #18884: Handle tag assignments manually within deserialize_object (#18908) 2025-03-17 08:43:08 -07:00
Benjamin Dale
0094703609 Closes #18816:Add FC/UPC, FC/APC and FC/PC port types (#18913)
* Closes #18816:Add FC/UPC, FC/APC and FC/PC port types

* Remove release note

---------

Co-authored-by: Ben Dale <7621213-ben_dale@users.noreply.gitlab.com>
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-03-17 10:39:28 -04:00
github-actions
f286449284 Update source translation strings 2025-03-14 05:02:07 +00:00
bctiemann
4f45328c77 Fixes: #18863 - Exempt MPTT-based models from centrally applying ordering on querysets (#18867) 2025-03-13 13:38:33 -07:00
Jeremy Stretch
994e7eb9f4 Fixes #18872: JournalEntry kind is a required field 2025-03-13 16:23:53 -04:00
Jeremy Stretch
ed135102be Fixes #18880: Delay enqueuing of background tasks until the DB transaction has been committed (#18899) 2025-03-13 11:34:12 -05:00
Jason Novinger
78332d44c7 Fixes #18845: restores sort behavior for DeviceTable.name column (#18861)
* Fixes #18845: restores sort behavior for DeviceTable.name column

* Remove accessor/order_by and modify DEVICE_LINK template

Thanks to @alehaa for the suggestion.

This also includes an additional `.select_related()` operation on
`DeviceListView.queryset` to avoid extra queries. Thanks to
@renatoalmeidaoliveira and @jeremystretch for pointing out the need for
this.
2025-03-13 09:22:49 -04:00
github-actions
80926cda8f Update source translation strings 2025-03-13 05:02:07 +00:00
bctiemann
d924d4eb33 Merge pull request #18886 from ITJamie/add-rackname-to-device-rack-view
Add rack title above rack view on device page
2025-03-12 19:11:22 -04:00
bctiemann
b1e7d7c76b Merge pull request #18826 from Tishka17/fix/generic_prefetch_4.2
Prefetch interface data for REST API on netbox 4.2
2025-03-12 18:55:58 -04:00
Jeremy Stretch
092f7549ca Fixes #18869: Ensure to_meters() always returns a clean decimal value (#18883)
* Fixes #18869: Ensure to_meters() always returns a clean decimal value

* Handle float values
2025-03-12 13:42:38 -05:00
Andrey Tikhonov
2f51dfc07a Merge branch 'fix/generic_prefetch_4.2' of github.com:Tishka17/netbox into fix/generic_prefetch_4.2 2025-03-12 19:13:34 +01:00
Andrey Tikhonov
906654d807 Fix empty line, comments 2025-03-12 19:09:46 +01:00
Renato Almeida de Oliveira
749a83d742 Change JSONField, prepare_value to output str with enclosing " (#18846) 2025-03-12 10:00:40 -07:00
Andrey Tikhonov
cdd25368e7 Merge branch 'main' into fix/generic_prefetch_4.2 2025-03-12 16:27:12 +01:00
Andrey Tikhonov
7d64d3b5ed Move GenericArrayForeignKey to fields module 2025-03-12 16:22:11 +01:00
github-actions
5e22ef59c5 Update source translation strings 2025-03-12 05:02:02 +00:00
Fabi
19d1282683 Fixes #18838: Correctly reject invalid falsy local context data (#18860)
* Correctly reject invalid falsy local context data.

* move tests
2025-03-11 14:18:42 -05:00
bctiemann
2266a8af67 Merge pull request #18804 from renatoalmeidaoliveira/18742-Location-List-and-Locations-not-Showing-Associated-VLAN-Groups
Fixes: #18742 Location List and Locations not Showing Associated VLAN Groups
2025-03-11 11:13:24 -04:00
Renato Almeida de Oliveira
5d81f911d6 Fixes: #18582 Bulk import prefixes with associated VLAN not working when multiple VLANs with the same vid exist. (#18844)
* Add site CSVModelChoiceField

* Change site field to vlan_site
2025-03-11 08:46:46 -04:00
github-actions
89e3f3d3e9 Update source translation strings 2025-03-11 05:02:10 +00:00
Jeremy Stretch
292463c0de Closes #18857: Fix deprecation warnings (#18858) 2025-03-10 14:40:08 -07:00
Antoine Keranflec'h
a9fd191086 Fixes: #18744 Add Contact link as hyperlink (#18847)
* contact link as hyperlink

* fix(lint) add missing blank lines

* simplify by using lambda function
2025-03-10 12:49:24 -05:00
Tobias Genannt
1a60cb9884 Fixes: #18568 Update mkdocstrings and adapt config (#18841)
* Fixes: #18568 Update mkdocstrings and adapt config

* Fixed some output formatting errors

When trying to compare the output from "mkdocstrings[python-legacy]==0.27.0" and
"mkdocstrings[python]==0.28.2" I encountered some HTML errors:
- <div> inside a <p>
- unescaped non-tags <pk>
2025-03-10 13:11:35 -04:00
Jason Novinger
76c3c613a9 Adds validation for ObjectListWidget.ConfigForm.model field 2025-03-10 09:57:45 -05:00
Jason Novinger
528248b560 Fixes #18782: properly check if htmx_url is None
If this is done incorrently, then the string formatting operation turns
`htmx_url` into a string and the test in the template fails.
2025-03-10 09:52:59 -05:00
github-actions
8823b07745 Update source translation strings 2025-03-08 05:02:21 +00:00
Mika Busch
29c25e39fc 17686 config option for disk divider (#18011) 2025-03-07 10:47:27 -08:00
Andrey Tikhonov
d103e13732 Removed automatic cache invalidation 2025-03-07 17:29:04 +01:00
github-actions
6d69c76b83 Update source translation strings 2025-03-07 05:02:48 +00:00
bctiemann
f9c8d12a51 Add docstrings for get_queryset base class methods (#18832) 2025-03-06 11:11:55 -06:00
Renato Almeida de Oliveira
3ef7ab4416 Fixes: #18579 Add contact filters to services (#18818)
* Add Contact filter to Services

* Add ContactModelFilterForm to ProviderAccountFilterForm

* Add Contact filter support for Aggregate

* Add Contact filter support for Prefix

* Add Contact filter to IPRange

* Add Contact filter to IPAddress

* Add Contact filter to L2VPN

* Add Contact filter to TunnelGroup

* Add Contact filter to Tunnel

* Add ContactModelFilterSet to ProviderAccountFilterSet

* Fixes classes inheritance order

Setup NetBoxModelFilterSetForm as the last inherited class

Co-authored-by: Jason Novinger <jnovinger@gmail.com>

---------

Co-authored-by: Jason Novinger <jnovinger@gmail.com>
2025-03-06 09:41:41 -06:00
bctiemann
2d35cc56ed Merge pull request #18823 from netbox-community/release-v4.2.5
Release v4.2.5
2025-03-06 10:10:13 -05:00
Andrey Tikhonov
741645c9f7 Merge branch 'develop' into fix/generic_prefetch_4.2 2025-03-06 16:05:25 +01:00
Andrey Tikhonov
d226af420b Merge branch 'develop' into fix/generic_prefetch_4.2 2025-03-06 16:02:32 +01:00
Andrey Tikhonov
5c88317745 cleanup unused imports and extra line 2025-03-06 16:01:59 +01:00
Jeremy Stretch
dffa380e5c Tweak issue ordering 2025-03-06 09:50:32 -05:00
Brian Tiemann
6d2426843b Merge remote-tracking branch 'origin/release-v4.2.5' into release-v4.2.5 2025-03-06 09:28:08 -05:00
Brian Tiemann
e72b0606ba Bump Django and add missing PRs 2025-03-06 09:27:44 -05:00
Jeremy Stretch
c933cbf11e Update translations 2025-03-06 09:00:09 -05:00
github-actions
9f1ffb54f5 Update source translation strings 2025-03-06 05:02:11 +00:00
Brian Tiemann
29b8827128 Add translation files 2025-03-05 18:52:34 -05:00
bctiemann
6efc5682cd Override get_queryset on generic ObjectListView and NetBoxModelViewSet to reapply model-level ordering (#18805) 2025-03-05 15:52:00 -08:00
Brian Tiemann
033a960cab Fix strawberry-graphql==0.262.0 2025-03-05 18:46:30 -05:00
Brian Tiemann
9f69c46a99 NetBox v4.2.5 2025-03-05 18:43:41 -05:00
Marcus Weiner
631ff3e702 Allow primary key for nested models in OpenAPI request schemas (#18451) 2025-03-05 11:46:12 -08:00
Renato Almeida de Oliveira Zaroubin
ed6ccfb723 Add commit test in job execution 2025-03-05 09:34:18 -05:00
Renato Almeida de Oliveira Zaroubin
d3a9a6827f fix typo in VirtualCircuitFilterForm 2025-03-05 09:28:00 -05:00
github-actions
057653d362 Update source translation strings 2025-03-05 05:02:11 +00:00
Daniel Sheppard
4ab58f2da9 Fixes: #15016 - Catch AssertionError from cable trace and throw ValidationError (#16384) 2025-03-04 10:57:27 -08:00
Renato Almeida de Oliveira Zaroubin
d83c2f45bc Add vlangroup into LocationTable, LocationListView queryset and related_models in LocationView 2025-03-04 18:34:23 +00:00
github-actions
d208ddde9a Update source translation strings 2025-03-04 05:02:19 +00:00
bctiemann
0fbfc4f38c Merge pull request #18789 from jamestiotio/18774-tag-description
Closes #18774: Set title attribute of each tag to its description
2025-03-03 11:35:33 -05:00
Jason Novinger
e86dba8fc8 Fixes #18768: allow removing secondary MACAddress from interface 2025-03-03 09:35:00 -05:00
atownson
3e1d4369ba Closes #17944: Allow filtering of ObjectVar and MultiObjectVar script inputs (#18725)
* Add the advanced object selector to the ObjectVar and MultiObjectVar script inputs

* Fix formatting issue
2025-03-03 09:20:04 -05:00
James Raphael Tiovalen
06b5ff2e4a Closes #18774: Set title attribute of each tag to its description 2025-03-02 18:40:40 +08:00
github-actions
3b1daaaad6 Update source translation strings 2025-03-01 05:02:06 +00:00
Jeremy Stretch
63a167f130 Fixes #15924: Fix API interface patch tagged all mode (#18759)
* Fixes: #15924 - Prevent API payload from allowing tagged_vlans while interface mode is set to taged-all

* Prevent cleanup of tagged_vlans when no tagged_vlans set on interface

* Fix test errors

* Remove accidental debug statements

* Update validation to model clean method instead of serializer

* Remove clearing of tagged vlans from `save()`

* Make changes to validation to account for M2M not being available under model in addition to not being able to check incoming vlans under same model.

* Optimize untagged vlan check

* Re-ordering statements in validators

* Forgot to call super().clean()

* Adjust logic for form and serializer.  Add tests

* Fix test failure

* Fix ruff errors

* Fix test by removing now invalid test

* Update serializer, form and tests

* Optimize API test for vlan fields

* Optimize API serializer logic

---------

Co-authored-by: Daniel Sheppard <dans@dansheps.com>
2025-02-28 11:01:48 -05:00
Jason Novinger
09d867adc3 Fixes #18758: Enable sorting by Account count on prodiver list (#18763) 2025-02-28 07:28:09 -08:00
Jeremy Stretch
7aba6500dd Fixes #18141: Fix quick-add support for plugin models 2025-02-26 14:25:38 -05:00
github-actions
787a2dd7c2 Update source translation strings 2025-02-26 05:02:07 +00:00
Marcus Weiner
c81f4da780 Fix definition of vid_ranges in VLANGroup so it shows up in the OpenAPI schema (#18237) 2025-02-25 16:34:15 -08:00
Renato Almeida de Oliveira
cffb99cec5 Fixes: #17796 Custom Field Choices -> Create & Add Another causes IndexError (#18631) 2025-02-25 14:44:10 -08:00
Brian Tiemann
3b894f9ccb Handle null table in TableConfigForm 2025-02-25 12:59:26 -05:00
Alexander Haase
bf836c9bc2 Fixes 17357: Use virtual chassis name as fallback for device (#18710) 2025-02-25 07:55:00 -08:00
bctiemann
4a4596d5e8 Merge pull request #18721 from atownson/issue_18403
Closes #18403: Do not retrieve the data field from Job objects unless needed
2025-02-25 10:24:42 -05:00
atownson
48b825c64a Closes #18024: Add URL pattern for scripts to reference them by module.name (#18723)
* Add URL pattern for scripts to reference them by module.name

* Change _get_script function name and syntax

* Fix formatting issue
2025-02-25 09:39:39 -05:00
bctiemann
4fb42ac7b3 Merge pull request #18724 from netbox-community/18605-prefix-vlan-assignment-display
Fixes #18605: only VLANs at selected Site are shown in VLAN select
2025-02-25 09:31:48 -05:00
bctiemann
a8b4024016 Merge pull request #18491 from antoinekh/17542-Contact_Assignment_to_vpn_tunnels
#17542 contact assignment to vpn tunnels
2025-02-25 09:23:14 -05:00
Antoine Keranflec'h
a6c07e6a35 fix contact wrong model assignment 2025-02-25 13:53:50 +01:00
Antoine Keranflec'h
59cd5bc653 fix double line breaks 2025-02-25 09:15:55 +01:00
Antoine Keranflec'h
bda4f314a4 Merge branch 'netbox-community:main' into 17542-Contact_Assignment_to_vpn_tunnels 2025-02-25 09:09:13 +01:00
github-actions
2a56c08bc8 Update source translation strings 2025-02-25 05:02:09 +00:00
Brian Tiemann
beb0aff656 Add VLAN Translation Policy to bulk edit forms and tables for Interface and VMInterface 2025-02-24 13:55:40 -05:00
Jason Novinger
64270d6a4e Fixes #18605: only VLANs at selected Site are shown in VLAN select 2025-02-24 11:29:31 -06:00
github-actions
fba4141ce3 Update source translation strings 2025-02-24 15:18:11 +00:00
Jeremy Stretch
a4ecb82330 Clarify error message 2025-02-24 10:14:52 -05:00
atownson
5a3e213fb4 Do not retrieve the data field from Job objects unless needed 2025-02-24 09:07:16 -06:00
Andrey Tikhonov
83ca0ef955 Add missed init 2025-02-24 15:43:07 +01:00
Andrey Tikhonov
9c3e7f2c5d Cleanup 2025-02-24 15:38:19 +01:00
Andrey Tikhonov
7794c6cfcb Fix link peers 2025-02-24 15:28:45 +01:00
Andrey Tikhonov
8dc1d68aee port generic field to 4.2 2025-02-24 15:20:18 +01:00
bctiemann
c4304d059c Merge pull request #18703 from netbox-community/release-v4.2.4
Release v4.2.4
2025-02-21 15:34:15 -05:00
Brian Tiemann
fee66438f3 Fix django-htmx version 2025-02-21 15:19:54 -05:00
Brian Tiemann
0f52712468 Release v4.2.4 2025-02-21 15:15:14 -05:00
Jeremy Stretch
fbaa82df7b Fixes #18674: Fix form reset when selecting a value from a speed selection dropdown 2025-02-21 14:04:50 -05:00
mr1716
9c1358e6e7 #18698 Correct REST Wikipedia URL In Documentation 2025-02-21 09:34:16 -05:00
github-actions
63b7145baa Update source translation strings 2025-02-21 05:02:07 +00:00
Jeremy Stretch
bcd974210d Update Transifex resource slug 2025-02-20 12:53:25 -05:00
Jason Novinger
ed79e3bbf4 Fixes #18619: shift-select selects hidden items
This also fixes the inverse, when a range is unselected via shift-click,
previously checked checkboxes that are hidden are not changed.
2025-02-20 10:17:43 -05:00
Alexander Haase
b5bc0bad38 Cover multitable inheritance in serialization
During serialization, custom fields may be available to a model due to
multi-table inheritance, but might not be available in serialized data
because only direct fields of the model are covered. Now this attribute
is only used if available in serialized data. Models using multi-table
inheritance must modify their serialize_object() method to cover parent
serialization.
2025-02-20 10:09:35 -05:00
Jason Novinger
2a44affd03 Fixes #18594: asn_count sort in Sites list (#18634)
* Fixes #18594: asn_count sort in Sites list

* Fixes similar issue in `circuits.views.ProviderListView`

Thanks @bctiemann for point this out!
2025-02-20 10:01:04 -05:00
Jamie Murphy
d9066d6cff add device rack title 2025-02-19 22:02:59 +00:00
Daniel Sheppard
49bcf57834 Update Style 2025-02-19 14:58:34 -06:00
github-actions
57ef44706a Update source translation strings 2025-02-19 05:02:03 +00:00
Jason Novinger
70dddb673b Fixes #18585: filtering circuits by location (#18641)
* Fixes #18585: filtering circuits by location

This also fixes a related issue where selected filter is not shown in
the filter form.

Changes:
- Adds `CircuitFilterSet.location_id` field to enable filtering with
  incoming GET params
- Adds `CirciotFilterForm.location_id` field to enable filtering from
  list form
- Adds `location_id` to the Location fieldset on `CircuitFilterForm`

* Adds test for new CircuitFilterset.location_id filter
2025-02-18 13:33:05 -05:00
Alexander Haase
6c6cb321bf Fixes 18555: Fix model URL generator for plugins (#18607)
* Fix model URL generator for plugins

* Fix reverse accessor warning

* Revert "Fix reverse accessor warning"

This reverts commit f07642bb99.

* Add URL test case for regular models

* Split dummy models

Instead of using a single model for testing, one is used for testing the
plugin API and a dedicated one is used for testing the NetBox plugin
model features.

* Fix filterset test case error

* Rename test module

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-02-18 09:11:32 -05:00
Renato Almeida de Oliveira
11514bfb21 Fixes: #18584 Add rack types column to manufacturers table (#18636)
* Add racktype_count annotation to list view queryset, create the LinkedCountColumn in ManufacturerTable

* Add Manufacturer field to RackTypeFilterForm
2025-02-18 08:41:12 -05:00
github-actions
c324d23634 Update source translation strings 2025-02-15 05:02:03 +00:00
Alexander Haase
f9431f1c29 Replace DurationChoices by JobIntervalChoices 2025-02-14 14:42:27 -05:00
Renato Almeida de Oliveira Zaroubin
b1ac20ac19 Update ModuleBay instance name before saving it 2025-02-14 14:22:29 -05:00
Daniel Sheppard
01cb7beb68 Update bundle 2025-02-13 10:51:48 -06:00
Daniel Sheppard
762ebe23f9 Merge branch '9583-add_column_specific_search_field_to_tables' of https://github.com/netbox-community/netbox into 9583-add_column_specific_search_field_to_tables 2025-02-13 10:50:13 -06:00
Daniel Sheppard
714495486b Merge branch 'feature' of https://github.com/netbox-community/netbox into 9583-add_column_specific_search_field_to_tables 2025-02-13 10:48:14 -06:00
github-actions
f8022040b2 Update source translation strings 2025-02-12 05:02:12 +00:00
Tobias Genannt
8114492673 Close #18357: Display author name for plugins 2025-02-11 12:19:43 -05:00
Renato Almeida de Oliveira
154b3a7abb Fixes: 18593 - "Create & Add Another" broken for new IP addresses (#18602)
* update IPAddressEditView get_extra_addanother_params

* Simplify get_extra_addanother_params
2025-02-11 08:31:40 -05:00
github-actions
015ef25ca0 Update source translation strings 2025-02-10 18:34:35 +00:00
Alexander Haase
3e1cc0d7f3 Fixes 18208: Consolidate rendering configuration templates (#18604) 2025-02-10 11:03:08 -05:00
Alexander Haase
e1d1aab4bd Omit empty related models 2025-02-10 10:56:09 -05:00
Matej Vadnjal
299bde9653 use script form's cleaned data when calling script from CLI
so ObjectVar and other field values have proper types in script's data variable
2025-02-10 09:46:59 -05:00
Alexander Haase
4b98f74943 Fixes 18247: Fix dark mode button classes (#18617) 2025-02-10 09:42:08 -05:00
Jeremy Stretch
a33fb2a0a9 Closes #17918: Fix styling of "tagged items" list under tag view 2025-02-10 09:00:55 -05:00
github-actions
13dc6854c2 Update source translation strings 2025-02-08 05:02:19 +00:00
Antoine Keranflec'h
e475386936 Fixes: #18408 add STATUS_PAUSED to VirtualMachine (#18595)
* feat(vm): add extra status

* keep only usefull status

---------

Co-authored-by: Antoine Keranflec'h <antoine.keranflech@worldline.com>
2025-02-07 16:41:45 -05:00
Jeremy Stretch
0b194e363e Docs cleanup 2025-02-07 15:33:37 -05:00
github-actions
72e93b04da Update source translation strings 2025-02-07 05:02:00 +00:00
Renato Almeida de Oliveira
7794b6718a Fixes: #18013 - All saved filters showing up for Change Log table, regardless 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 <jstretch@netboxlabs.com>
2025-02-06 17:21:46 -05:00
Renato Almeida de Oliveira
efa939d0c2 Fixes: #18241 - Script results log_threshold should default to Default (#18501)
* Changed LogLevelChoices order; Changed ScriptResultView to select LogLevelChoices to LOG_DEFAULT and setup the html template to put (All) in the last one

* Change LogLevelChoices in ScriptResultView get_table method

* Remove default option, add Default string to INFO

* Fix scripts.py and reports.py to reflect removing DEFAULT level

* fix linting
2025-02-06 16:30:25 -05:00
Jeremy Stretch
697610db94 Closes #18541: Document support for auth_required attribute on PluginMenuItem 2025-02-06 14:45:25 -05:00
Jeremy Stretch
8e91db0394 Misc cleanup of the release checklist 2025-02-05 11:40:53 -05:00
Arthur
d202b3529d Merge branch 'main' into feature 2025-02-04 13:05:40 -08:00
Jeremy Stretch
75417c9cd5 Closes #17587: Add release_track attribute to PluginConfig 2025-02-03 13:54:52 -05:00
Jeremy Stretch
43841939a0 Closes #18540: Track installed plugins in registry 2025-02-03 13:42:32 -05:00
Antoine Keranflec'h
2a8728544c fix(pep) fix pep8 compliancy 2025-01-31 08:48:35 +01:00
Antoine Keranflec'h
f83e55e1db Merge branch 'netbox-community:main' into 17542-Contact_Assignment_to_vpn_tunnels 2025-01-25 14:19:25 +01:00
Daniel Sheppard
e7649f0cc2 Fix test error 2025-01-20 18:45:28 -06:00
Daniel Sheppard
434cf37988 Fix test error and OOB-swap 2025-01-20 18:27:26 -06:00
Daniel Sheppard
451a1f498d Remove debug 2025-01-20 17:35:20 -06:00
Daniel Sheppard
694fcd3a79 Fix assets 2025-01-20 17:31:16 -06:00
Daniel Sheppard
7e5d8eaf05 Debugging 2025-01-20 17:21:29 -06:00
Daniel Sheppard
1958965c36 More bundle debugging 2025-01-20 17:16:33 -06:00
Daniel Sheppard
e12ae3acde Figure out what is failing 2025-01-20 17:11:11 -06:00
Daniel Sheppard
a28871296c Fix assets 2025-01-20 17:07:25 -06:00
Daniel Sheppard
ee83895e2a Fix bundles 2025-01-20 16:42:59 -06:00
Daniel Sheppard
764c676ffc Fix bundles 2025-01-20 15:54:07 -06:00
Daniel Sheppard
92f6f426b3 Removed unused import 2025-01-20 14:51:15 -06:00
Daniel Sheppard
4381ea9265 Merge Head 2025-01-20 14:24:47 -06:00
Daniel Sheppard
92c3bbc9db Correct issue with filter_form not passing through render_table from django_tables2 2025-01-20 14:21:41 -06:00
Daniel Sheppard
8d65973c82 Simplify table header filter rendering 2025-01-20 13:13:19 -06:00
Daniel Sheppard
882aa30043 Simplify filter generation 2025-01-20 12:06:26 -06:00
Daniel Sheppard
f2c74db761 Update display of filtering chits 2025-01-20 12:03:41 -06:00
Daniel Sheppard
852535e3d4 Merge in updates from feature 2025-01-20 11:41:26 -06:00
Jeremy Stretch
012e815f3b Merge branch 'feature' into 9583-add_column_specific_search_field_to_tables 2024-12-06 15:59:06 -05:00
Antoine Keranflec'h
113c8d1d85 Merge branch 'netbox-community:develop' into 17542-Contact_Assignment_to_vpn_tunnels 2024-11-12 14:17:05 +01:00
Daniel Sheppard
d6ab7b7378 Update bundle 2024-10-16 22:24:48 -05:00
Daniel Sheppard
77cb8ac817 Merge branch 'feature' into 9583-add_column_specific_search_field_to_tables 2024-10-16 22:13:01 -05:00
Antoine Keranflec'h
5b2241aaaf fix(17542) add contact to tunnels 2024-10-10 15:38:48 +02:00
Daniel Sheppard
b12ce97474 Update to latest feature 2024-07-01 22:27:15 -05:00
Daniel Sheppard
0ad1db9912 Regnerate CSS 2024-06-12 23:22:13 -05:00
Daniel Sheppard
f1306783dc Merge branch 'feature' of https://github.com/netbox-community/netbox into 9583-add_column_specific_search_field_to_tables
# Conflicts:
#	netbox/project-static/dist/netbox.css
#	netbox/templates/htmx/table.html
#	netbox/templates/inc/table_htmx.html
2024-06-12 23:10:25 -05:00
Daniel Sheppard
30e653197e Add a table form override and add a table column remap option 2024-06-12 23:01:33 -05:00
Daniel Sheppard
fd38255d31 Rename swap variable back and remove join 2024-04-25 13:04:37 -05:00
Daniel Sheppard
5830ae9e9a Rename variable for doing OOB swaps on the table 2024-04-25 12:53:54 -05:00
Daniel Sheppard
479c69bd2d Fix up duplication of template chits when rendering HTMX 2024-04-22 22:42:42 -05:00
Daniel Sheppard
1c995fa5f9 Perform OOB swap for filter badges 2024-04-15 08:43:51 -05:00
Daniel Sheppard
35cff12974 Apply suggestions from Arthur 2024-04-15 08:10:40 -05:00
Daniel Sheppard
a9aa0cbaa0 Merge in latest feature 2024-04-15 07:30:28 -05:00
Daniel Sheppard
8ad79a64ae Update CSS 2024-03-21 23:18:31 -05:00
Daniel Sheppard
a422a3cd98 Modify logic for table column filtering to further isolate the column filtering and the filterset tab 2024-03-21 23:09:30 -05:00
Daniel Sheppard
8a7df0b98d Update netbox/utilities/templatetags/form_helpers.py
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-03-21 22:37:06 -05:00
Daniel Sheppard
f257f4aad4 Apply suggestions from code review
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-03-21 22:18:34 -05:00
Jeremy Stretch
25a4e9448c Merge branch 'feature' into 9583-add_column_specific_search_field_to_tables 2024-03-20 15:02:12 -04:00
Jeremy Stretch
77bfd620c3 Merge branch 'feature' into 9583-add_column_specific_search_field_to_tables 2024-03-07 08:50:17 -05:00
Daniel Sheppard
84151cbc1a Fix tom-select errors related to field id. Break out render_field function for column filters 2024-02-13 15:23:14 -06:00
Daniel Sheppard
0309796bbb Fix extraneous __all__ entry 2024-02-12 16:09:02 -06:00
Daniel Sheppard
f81f76f862 Optimizations 2024-02-12 16:00:19 -06:00
Daniel Sheppard
c3f1a9601c Update CSS after merge 2024-02-12 09:49:15 -06:00
Daniel Sheppard
4ae6683abc Merge in recent feture changes 2024-02-12 09:44:30 -06:00
Daniel Sheppard
06c1aff04f Fix test failure 2024-02-12 08:17:53 -06:00
Daniel Sheppard
5f69666b7b Change dropdown position and fix test failure 2024-02-11 21:37:33 -06:00
Daniel Sheppard
b54cfd6ba9 Update CSS 2024-02-11 21:17:06 -06:00
Daniel Sheppard
3243ebd1dd Merge remote-tracking branch 'origin/9583-add_column_specific_search_field_to_tables' into 9583-add_column_specific_search_field_to_tables 2024-02-09 16:37:47 -06:00
Daniel Sheppard
03f67f373f CSS update for dropdown 2024-02-09 16:36:13 -06:00
Daniel Sheppard
50557c0f9d Final work on #9583 for basic functionality 2024-02-09 16:35:09 -06:00
Daniel Sheppard
cc423f5071 Apply some quick fixes and add comments 2024-02-07 13:48:32 -06:00
Daniel Sheppard
664a0eba6d Preliminary work on 9583. 2024-02-07 13:40:20 -06:00
Daniel Sheppard
f7294f7087 Preliminary work on 9583. 2024-02-07 13:37:57 -06:00
Daniel Sheppard
e762755e80 HTMX work on 9583. 2024-02-07 12:05:11 -06:00
Daniel Sheppard
4c39516253 Preliminary work on 9583. 2024-02-02 15:49:32 -06:00
21 changed files with 176 additions and 45 deletions
+1
View File
@@ -103,6 +103,7 @@ NetBox looks for the `config` variable within a plugin's `__init__.py` to load i
| `name` | Raw plugin name; same as the plugin's source directory |
| `verbose_name` | Human-friendly name for the plugin |
| `version` | Current release ([semantic versioning](https://semver.org/) is encouraged) |
| `release_track` | An alternate release track (e.g. `dev` or `beta`) to which a release belongs |
| `description` | Brief description of the plugin's purpose |
| `author` | Name of plugin's author |
| `author_email` | Author's public email address |
+8 -7
View File
@@ -64,13 +64,14 @@ item1 = PluginMenuItem(
A `PluginMenuItem` has the following attributes:
| Attribute | Required | Description |
|---------------|----------|----------------------------------------------------------------------------------------------------------|
| `link` | Yes | Name of the URL path to which this menu item links |
| `link_text` | Yes | The text presented to the user |
| `permissions` | - | A list of permissions required to display this link |
| `staff_only` | - | Display only for users who have `is_staff` set to true (any specified permissions will also be required) |
| `buttons` | - | An iterable of PluginMenuButton instances to include |
| Attribute | Required | Description |
|-----------------|----------|----------------------------------------------------------------------------------------------------------|
| `link` | Yes | Name of the URL path to which this menu item links |
| `link_text` | Yes | The text presented to the user |
| `permissions` | - | A list of permissions required to display this link |
| `auth_required` | - | Display only for authenticated users |
| `staff_only` | - | Display only for users who have `is_staff` set to true (any specified permissions will also be required) |
| `buttons` | - | An iterable of PluginMenuButton instances to include |
## Menu Buttons
+6 -2
View File
@@ -9,6 +9,7 @@ from django.conf import settings
from django.core.cache import cache
from netbox.plugins import PluginConfig
from netbox.registry import registry
from utilities.datetime import datetime_from_timestamp
USER_AGENT_STRING = f'NetBox/{settings.RELEASE.version} {settings.RELEASE.edition}'
@@ -76,9 +77,12 @@ def get_local_plugins(plugins=None):
local_plugins = {}
# Gather all locally-installed plugins
for plugin_name in settings.PLUGINS:
for plugin_name in registry['plugins']['installed']:
plugin = importlib.import_module(plugin_name)
plugin_config: PluginConfig = plugin.config
installed_version = plugin_config.version
if plugin_config.release_track:
installed_version = f'{installed_version}-{plugin_config.release_track}'
local_plugins[plugin_config.name] = Plugin(
config_name=plugin_config.name,
@@ -88,7 +92,7 @@ def get_local_plugins(plugins=None):
description_short=plugin_config.description,
is_local=True,
is_installed=True,
installed_version=plugin_config.version,
installed_version=installed_version,
)
# Update catalog entries for local plugins, or add them to the list if not listed
+2 -1
View File
@@ -22,6 +22,7 @@ from rq.worker_registration import clean_worker_registry
from core.utils import delete_rq_job, enqueue_rq_job, get_rq_jobs_from_status, requeue_rq_job, stop_rq_job
from netbox.config import get_config, PARAMS
from netbox.registry import registry
from netbox.views import generic
from netbox.views.generic.base import BaseObjectView
from netbox.views.generic.mixins import TableMixin
@@ -560,7 +561,7 @@ class SystemView(UserPassesTestMixin, View):
params = [param.name for param in PARAMS]
data = {
**stats,
'plugins': settings.PLUGINS,
'plugins': registry['plugins']['installed'],
'config': {
k: getattr(config, k) for k in sorted(params)
},
+2
View File
@@ -16,6 +16,7 @@ from .utils import *
# Initialize plugin registry
registry['plugins'].update({
'installed': [],
'graphql_schemas': [],
'menus': [],
'menu_items': {},
@@ -47,6 +48,7 @@ class PluginConfig(AppConfig):
author_email = ''
description = ''
version = ''
release_track = ''
# Root URL path under /plugins. If not set, the plugin's label will be used.
base_url = None
+2 -2
View File
@@ -1,11 +1,11 @@
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.conf.urls import include
from django.urls import path
from django.utils.module_loading import import_string, module_has_submodule
from netbox.registry import registry
from . import views
plugin_patterns = []
@@ -15,7 +15,7 @@ plugin_api_patterns = [
]
# Register base/API URL patterns for each plugin
for plugin_path in settings.PLUGINS:
for plugin_path in registry['plugins']['installed']:
plugin = import_module(plugin_path)
plugin_name = plugin_path.split('.')[-1]
app = apps.get_app_config(plugin_name)
+7 -2
View File
@@ -2,6 +2,8 @@ from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from netbox.registry import registry
__all__ = (
'get_installed_plugins',
'get_plugin_config',
@@ -13,10 +15,13 @@ def get_installed_plugins():
Return a dictionary mapping the names of installed plugins to their versions.
"""
plugins = {}
for plugin_name in settings.PLUGINS:
for plugin_name in registry['plugins']['installed']:
plugin_name = plugin_name.rsplit('.', 1)[-1]
plugin_config = apps.get_app_config(plugin_name)
plugins[plugin_name] = getattr(plugin_config, 'version', None)
if plugin_config.release_track:
plugins[plugin_name] = f'{plugin_config.version}-{plugin_config.release_track}'
else:
plugins[plugin_name] = plugin_config.version or None
return dict(sorted(plugins.items()))
+9 -4
View File
@@ -1,7 +1,6 @@
from collections import OrderedDict
from django.apps import apps
from django.conf import settings
from django.urls.exceptions import NoReverseMatch
from drf_spectacular.utils import extend_schema
from rest_framework import permissions
@@ -9,6 +8,8 @@ from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from netbox.registry import registry
@extend_schema(exclude=True)
class InstalledPluginsAPIView(APIView):
@@ -30,11 +31,15 @@ class InstalledPluginsAPIView(APIView):
'author': plugin_app_config.author,
'author_email': plugin_app_config.author_email,
'description': plugin_app_config.description,
'version': plugin_app_config.version
'version': plugin_app_config.version,
'release_track': plugin_app_config.release_track,
}
def get(self, request, format=None):
return Response([self._get_plugin_data(apps.get_app_config(plugin)) for plugin in settings.PLUGINS])
return Response([
self._get_plugin_data(apps.get_app_config(plugin))
for plugin in registry['plugins']['installed']
])
@extend_schema(exclude=True)
@@ -64,7 +69,7 @@ class PluginsAPIRootView(APIView):
def get(self, request, format=None):
entries = []
for plugin in settings.PLUGINS:
for plugin in registry['plugins']['installed']:
app_config = apps.get_app_config(plugin)
entry = self._get_plugin_entry(plugin, app_config, request, format)
if entry is not None:
+4
View File
@@ -14,6 +14,7 @@ from django.utils.translation import gettext_lazy as _
from netbox.config import PARAMS as CONFIG_PARAMS
from netbox.constants import RQ_QUEUE_DEFAULT, RQ_QUEUE_HIGH, RQ_QUEUE_LOW
from netbox.plugins import PluginConfig
from netbox.registry import registry
from utilities.release import load_release_data
from utilities.string import trailing_slash
@@ -810,6 +811,9 @@ for plugin_name in PLUGINS:
f"__init__.py file and point to the PluginConfig subclass."
)
# Register the plugin as installed successfully
registry['plugins']['installed'].append(plugin_name)
plugin_module = "{}.{}".format(plugin_config.__module__, plugin_config.__name__) # type: ignore
# Gather additional apps to load alongside this plugin
+1
View File
@@ -44,6 +44,7 @@ class BaseTable(tables.Table):
:param user: Personalize table display for the given user (optional). Has no effect if AnonymousUser is passed.
"""
exempt_columns = ()
filterset_form = None
class Meta:
attrs = {
+16 -2
View File
@@ -170,6 +170,20 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
# Render the objects table
table = self.get_table(self.queryset, request, has_bulk_actions)
# Check for filterset_form(s) on this view and/or the table, if a form exists:
# * If both exist, initialize both
# * If a filterset form for the table exists, only initialize the table filterset_form
# * If a filterset form exists for the view, initialize the filterset form
# * Apply to the table for use by the table and initialize a separate instance of the form for use by the table
# column filters
# * Otherwise set to None
if self.filterset_form:
filterset_form = self.filterset_form(request.GET)
table.filterset_form = self.filterset_form(request.GET)
else:
filterset_form = None
table.filterset_form = None
# If this is an HTMX request, return only the rendered table HTML
if htmx_partial(request):
if request.GET.get('embedded', False):
@@ -179,15 +193,15 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
table.columns.hide('pk')
return render(request, 'htmx/table.html', {
'table': table,
'filter_form': filterset_form,
'model': model,
'actions': actions,
})
context = {
'model': model,
'table': table,
'actions': actions,
'filter_form': self.filterset_form(request.GET) if self.filterset_form else None,
'filter_form': filterset_form,
'prerequisite_model': get_prerequisite_model(self.queryset),
**self.get_extra_context(request),
}
File diff suppressed because one or more lines are too long
@@ -29,6 +29,23 @@ span.color-label {
opacity: 0;
}
// Override bootstrap "dropdown" positioning and display for column filters
.column-filter {
position: static;
display: inline;
}
// Override mdi font-size to adjust filter icon size
.column-filter.dropdown > .dropdown-toggle > .mdi-filter-settings {
font-size: .625rem;
}
.column-filter.dropdown > .dropdown-menu {
max-width: 300px;
}
.column-filter.dropdown-toggle:after { content: none }
// NetBox edition text
.netbox-edition {
letter-spacing: .15rem;
+2 -3
View File
@@ -66,9 +66,8 @@ Context:
{# Object list tab #}
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
{# Applied filters #}
{% if filter_form %}
{% if not request.htmx %}
{# Applied filters #}
{% applied_filters model filter_form request.GET %}
{% endif %}
+5
View File
@@ -3,6 +3,11 @@
{% load buttons %}
{% load render_table from django_tables2 %}
{% if request.htmx %}
{# OOB Swaps to update various components #}
{% applied_filters model filter_form request.GET %}
{% endif %}
<div class="htmx-container table-responsive">
{% with preferences|get_key:"pagination.placement" as paginator_placement %}
{% if paginator_placement == 'top' or paginator_placement == 'both' %}
@@ -5,7 +5,7 @@
<div class="col-auto d-print-none">
<div class="input-group input-group-flat me-2 quicksearch" hx-disinherit="hx-select hx-swap">
<input type="search" results="5" name="q" id="quicksearch" class="form-control" placeholder="{% trans "Quick search" %}"
hx-get="{{ request.full_path }}" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search"/>
hx-get="" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search"/>
<span class="input-group-text py-1">
<a href="#" id="quicksearch_clear" class="invisible text-secondary"><i class="mdi mdi-close-circle"></i></a>
</span>
+5 -1
View File
@@ -1,4 +1,5 @@
{% load django_tables2 %}
{% load form_helpers %}
{% load i18n %}
<table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %} hx-disinherit="hx-target hx-select" hx-swap="outerHTML">
{% if table.show_header %}
@@ -15,12 +16,15 @@
<a href="#"
hx-get="{{ table.htmx_url }}{% querystring table.prefixed_order_by_field='' %}"
class="text-danger"
{% if not table.embedded %}hx-push-url="true"{% endif %}
title="{% trans "Clear ordering" %}"
><i class="mdi mdi-close"></i></a>
</div>
{% endif %}
{% render_table_filter_field column.name table request%}
<a href="#"
hx-get="{{ table.htmx_url }}{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}"
hx-get="{{ table.htmx_url }}{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}"
{% if not table.embedded %}hx-push-url="true"{% endif %}
>{{ column.header }}</a>
</th>
{% else %}
@@ -0,0 +1,11 @@
{% load form_helpers %}
{% if field %}
<div class="column-filter dropdown">
<a href="#" class="dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside"><i class="mdi mdi-filter-settings"></i></a>
<div class="dropdown-menu">
<div class="px-3 py-3">
{% include "form_helpers/render_field.html" %}
</div>
</div>
</div>
{% endif %}
@@ -1,20 +1,22 @@
{% load i18n %}
{% if applied_filters %}
<div class="mb-3">
{% for filter in applied_filters %}
<a href="{{ filter.link_url }}" class="badge rounded-pill text-bg-primary text-decoration-none me-1">
<i class="mdi mdi-close"></i> {{ filter.link_text }}
</a>
{% endfor %}
{% if applied_filters|length > 1 %}
<a href="?" class="badge rounded-pill text-bg-danger text-decoration-none me-1">
<i class="mdi mdi-tag-off"></i> {% trans "Clear all" %}
</a>
{% endif %}
{% if save_link %}
<a href="{{ save_link }}" class="badge rounded-pill text-bg-success text-decoration-none me-1">
<i class="mdi mdi-content-save"></i> {% trans "Save" %}
</a>
{% endif %}
</div>
{% endif %}
<div id="applied_filters_pane" hx-swap-oob="true">
{% if applied_filters %}
<div class="mb-3">
{% for filter in applied_filters %}
<a href="{{ filter.link_url }}" class="badge rounded-pill text-bg-primary text-decoration-none me-1">
<i class="mdi mdi-close"></i> {{ filter.link_text }}
</a>
{% endfor %}
{% if applied_filters|length > 1 %}
<a href="?" class="badge rounded-pill text-bg-danger text-decoration-none me-1">
<i class="mdi mdi-tag-off"></i> {% trans "Clear all" %}
</a>
{% endif %}
{% if save_link %}
<a href="{{ save_link }}" class="badge rounded-pill text-bg-success text-decoration-none me-1">
<i class="mdi mdi-content-save"></i> {% trans "Save" %}
</a>
{% endif %}
</div>
{% endif %}
</div>
@@ -7,10 +7,12 @@ __all__ = (
'render_custom_fields',
'render_errors',
'render_field',
'render_table_filter_field',
'render_form',
'widget_type',
)
from utilities.templatetags.helpers import querystring
register = template.Library()
@@ -30,6 +32,11 @@ def getfield(form, fieldname):
return None
@register.filter()
def get_filter_field(form, fieldname):
return getfield(form, f'{fieldname}') or getfield(form, f'{fieldname}_id')
@register.filter(name='widget_type')
def widget_type(field):
"""
@@ -47,6 +54,7 @@ def widget_type(field):
# Inclusion tags
#
@register.inclusion_tag('form_helpers/render_fieldset.html')
def render_fieldset(form, fieldset):
"""
@@ -109,6 +117,7 @@ def render_field(field, bulk_nullable=False, label=None):
"""
Render a single form field from template
"""
return {
'field': field,
'label': label or field.label,
@@ -116,6 +125,49 @@ def render_field(field, bulk_nullable=False, label=None):
}
@register.inclusion_tag('form_helpers/render_table_filter_field.html')
def render_table_filter_field(fieldname, table, request):
"""
Render a single form field for table column filters from template
"""
url = ""
field = None
# Does this table have a filterset form?
if hasattr(table, 'filterset_form') and table.filterset_form is not None:
# Get the filterset field
field = get_filter_field(table.filterset_form, fieldname)
# Return if no filterset field
if field is None:
return {}
# Handle filter forms
if table:
# Build kwargs for querystring function
kwargs = {field.name: None}
# Build request url
if request and table.htmx_url:
url = table.htmx_url + querystring(request, **kwargs)
elif request:
url = querystring(request, **kwargs)
# Set HTMX args
if hasattr(field.field, 'widget'):
field.field.widget.attrs.update({
'id': f'table_filter_id_{field.name}',
'hx-get': url if url else '#',
'hx-push-url': "true",
'hx-trigger': 'hidden.bs.dropdown from:closest .dropdown'
})
return {
'field': field,
'label': None,
'bulk_nullable': False,
}
@register.inclusion_tag('form_helpers/render_custom_fields.html')
def render_custom_fields(form):
"""
+3
View File
@@ -270,6 +270,8 @@ def applied_filters(context, model, form, query_params):
Display the active filters for a given filter form.
"""
user = context['request'].user
if not form:
return
form.is_valid() # Ensure cleaned_data has been set
applied_filters = []
@@ -304,6 +306,7 @@ def applied_filters(context, model, form, query_params):
save_link = f"{url}?object_types={object_type}&parameters={quote(parameters)}"
return {
'request': context['request'],
'applied_filters': applied_filters,
'save_link': save_link,
}