[PR #18009] [MERGED] Closes #11279: Replace _name natural key sorting with collation #15246

Closed
opened 2025-12-30 00:20:51 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18009
Author: @arthanson
Created: 11/13/2024
Status: Merged
Merged: 11/15/2024
Merged by: @jeremystretch

Base: featureHead: 11279-natural-key


📝 Commits (10+)

📊 Changes

35 files changed (+622 additions, -150 deletions)

View changed files

netbox/circuits/migrations/0049_natural_ordering.py (+22 -0)
📝 netbox/circuits/models/providers.py (+4 -2)
📝 netbox/core/tests/test_changelog.py (+0 -28)
📝 netbox/dcim/graphql/types.py (+5 -15)
netbox/dcim/migrations/0197_natural_sort_collation.py (+17 -0)
netbox/dcim/migrations/0198_natural_ordering.py (+318 -0)
📝 netbox/dcim/models/device_component_templates.py (+5 -9)
📝 netbox/dcim/models/device_components.py (+4 -8)
📝 netbox/dcim/models/devices.py (+8 -11)
📝 netbox/dcim/models/power.py (+4 -2)
📝 netbox/dcim/models/racks.py (+3 -7)
📝 netbox/dcim/models/sites.py (+3 -8)
📝 netbox/dcim/tables/devices.py (+6 -12)
📝 netbox/dcim/tables/devicetypes.py (+5 -3)
📝 netbox/dcim/tables/racks.py (+0 -1)
📝 netbox/dcim/views.py (+3 -4)
netbox/ipam/migrations/0076_natural_ordering.py (+32 -0)
📝 netbox/ipam/models/asns.py (+2 -1)
📝 netbox/ipam/models/vlans.py (+2 -1)
📝 netbox/ipam/models/vrfs.py (+4 -2)

...and 15 more files

📄 Description

Fixes: #11279

  • Interface uses naturalize_interface so needed to keep _name on it, same for VMInterface
  • utilities.ordering.naturalize does not look like it is used anymore but is used in migrations so can't be removed currently - we could backport changes to old migrations and remove it if wanted.

See the screenshot for sorting - accented / umlaut characters are handled better then before and look to be in the correct ordering.
Sites | NetBox 2024-11-13 13-00-08


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18009 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 11/13/2024 **Status:** ✅ Merged **Merged:** 11/15/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `11279-natural-key` --- ### 📝 Commits (10+) - [`4062986`](https://github.com/netbox-community/netbox/commit/4062986e069600b7d2176a6c93389a81d1c681f0) 11279 add collation - [`3309949`](https://github.com/netbox-community/netbox/commit/33099499d653bd1208908aeb65f49b3d996166f2) 11279 add collation - [`fb19be9`](https://github.com/netbox-community/netbox/commit/fb19be9cca3b00b5c030c2223119389de2c16534) 11279 add collation - [`5518286`](https://github.com/netbox-community/netbox/commit/5518286c792d09a5e21700c3e71aecc2117495b5) 11279 add collation - [`39438a2`](https://github.com/netbox-community/netbox/commit/39438a239a4a6c3d2f9209ecdc2a3d0573070761) 11279 fix tables /tests - [`23a22e7`](https://github.com/netbox-community/netbox/commit/23a22e7f1ca8e694cd58e06985587749a7fe6ea8) 11279 fix tests - [`973c410`](https://github.com/netbox-community/netbox/commit/973c410db212549fe3e335930f676988cd3599b0) 11279 refactor VirtualDisk - [`d1802bf`](https://github.com/netbox-community/netbox/commit/d1802bff0b43636dc3ac4f440b66774f057adbb8) Clean up migrations - [`8a42c72`](https://github.com/netbox-community/netbox/commit/8a42c72ca46d36bc0e41c78855a9ae82a98efaa0) Misc cleanup - [`baa4142`](https://github.com/netbox-community/netbox/commit/baa4142f84ac2ec383cdde056cc72ba2ae7d8a10) Correct errant file inclusion ### 📊 Changes **35 files changed** (+622 additions, -150 deletions) <details> <summary>View changed files</summary> ➕ `netbox/circuits/migrations/0049_natural_ordering.py` (+22 -0) 📝 `netbox/circuits/models/providers.py` (+4 -2) 📝 `netbox/core/tests/test_changelog.py` (+0 -28) 📝 `netbox/dcim/graphql/types.py` (+5 -15) ➕ `netbox/dcim/migrations/0197_natural_sort_collation.py` (+17 -0) ➕ `netbox/dcim/migrations/0198_natural_ordering.py` (+318 -0) 📝 `netbox/dcim/models/device_component_templates.py` (+5 -9) 📝 `netbox/dcim/models/device_components.py` (+4 -8) 📝 `netbox/dcim/models/devices.py` (+8 -11) 📝 `netbox/dcim/models/power.py` (+4 -2) 📝 `netbox/dcim/models/racks.py` (+3 -7) 📝 `netbox/dcim/models/sites.py` (+3 -8) 📝 `netbox/dcim/tables/devices.py` (+6 -12) 📝 `netbox/dcim/tables/devicetypes.py` (+5 -3) 📝 `netbox/dcim/tables/racks.py` (+0 -1) 📝 `netbox/dcim/views.py` (+3 -4) ➕ `netbox/ipam/migrations/0076_natural_ordering.py` (+32 -0) 📝 `netbox/ipam/models/asns.py` (+2 -1) 📝 `netbox/ipam/models/vlans.py` (+2 -1) 📝 `netbox/ipam/models/vrfs.py` (+4 -2) _...and 15 more files_ </details> ### 📄 Description ### Fixes: #11279 * Interface uses naturalize_interface so needed to keep _name on it, same for VMInterface * utilities.ordering.naturalize does not look like it is used anymore but is used in migrations so can't be removed currently - we could backport changes to old migrations and remove it if wanted. See the screenshot for sorting - accented / umlaut characters are handled better then before and look to be in the correct ordering. ![Sites | NetBox 2024-11-13 13-00-08](https://github.com/user-attachments/assets/25643e46-d598-4141-a3fc-5fd29bb47cb2) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:20:51 +01:00
adam closed this issue 2025-12-30 00:20:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15246