[PR #4122] [MERGED] Closes #3799: Remove NaturalOrderingManager #12762

Closed
opened 2025-12-29 22:23:28 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/4122
Author: @jeremystretch
Created: 2/7/2020
Status: Merged
Merged: 2/7/2020
Merged by: @jeremystretch

Base: developHead: 3799-natural-ordering-field


📝 Commits (10+)

  • b271fd3 Introduce NaturalOrderingField
  • 12d09e2 Convert device components to use NaturalOrderingField
  • 705c352 Convert device component templates to use NaturalOrderingField
  • 099c446 Convert remaining DCIM models to use NaturalOrderingField
  • 35511cf Remove NaturalOrderingManager
  • c72a353 Enable reverse migration
  • dc1b787 Store empty names as null
  • 12c7d83 Fix PowerOutlet migrations
  • 9adeed5 Update table field ordering
  • 7c74d2c Convert interface models to use NaturalOrderingField

📊 Changes

13 files changed (+704 additions, -201 deletions)

View changed files

📝 docs/release-notes/version-2.7.md (+1 -0)
📝 netbox/dcim/managers.py (+1 -55)
netbox/dcim/migrations/0093_device_component_ordering.py (+147 -0)
netbox/dcim/migrations/0094_device_component_template_ordering.py (+138 -0)
netbox/dcim/migrations/0095_primary_model_ordering.py (+70 -0)
netbox/dcim/migrations/0096_interface_ordering.py (+53 -0)
📝 netbox/dcim/models/__init__.py (+29 -20)
📝 netbox/dcim/models/device_component_templates.py (+62 -37)
📝 netbox/dcim/models/device_components.py (+72 -41)
📝 netbox/dcim/tables.py (+18 -3)
📝 netbox/utilities/fields.py (+33 -0)
netbox/utilities/managers.py (+0 -45)
netbox/utilities/ordering.py (+80 -0)

📄 Description

Fixes: #3799

  • Introduce NaturalOrderingField for storing pre-rendered natural ordering-friendly values on models
  • Introduce naturalize() and naturalize_interface() to handle generating values suitable for natural ordering
  • Add a NaturalOrderingField (_name) to the site, rack, and device models, as well as all device components and component templates
  • Extend schema migrations to automatically generate naturalized values for existing objects
  • Remove NaturalOrderingManager
  • Remove custom ordering logic from InterfaceManager

🔄 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/4122 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 2/7/2020 **Status:** ✅ Merged **Merged:** 2/7/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `3799-natural-ordering-field` --- ### 📝 Commits (10+) - [`b271fd3`](https://github.com/netbox-community/netbox/commit/b271fd32bdadd6f9cbd5e2261554f70837cd06ac) Introduce NaturalOrderingField - [`12d09e2`](https://github.com/netbox-community/netbox/commit/12d09e2274d46e242dcc50128202d117a3415ee8) Convert device components to use NaturalOrderingField - [`705c352`](https://github.com/netbox-community/netbox/commit/705c35288542263113095ec7bd896882f1a8ae4e) Convert device component templates to use NaturalOrderingField - [`099c446`](https://github.com/netbox-community/netbox/commit/099c446f389344faec5f60e2d2352dd2740361fd) Convert remaining DCIM models to use NaturalOrderingField - [`35511cf`](https://github.com/netbox-community/netbox/commit/35511cfdc1a2b70c3ac98f951b933e9fe5c076bf) Remove NaturalOrderingManager - [`c72a353`](https://github.com/netbox-community/netbox/commit/c72a353733420fa40edabf69d4548668b0b8c32b) Enable reverse migration - [`dc1b787`](https://github.com/netbox-community/netbox/commit/dc1b7874ff4b7a7f6a8b2bb96fdb0fc4f58754a2) Store empty names as null - [`12c7d83`](https://github.com/netbox-community/netbox/commit/12c7d83a9178ed8bcde13bee53a9217e23f0b61b) Fix PowerOutlet migrations - [`9adeed5`](https://github.com/netbox-community/netbox/commit/9adeed55fb14f49ffaeab18056e2fafebc518f4e) Update table field ordering - [`7c74d2c`](https://github.com/netbox-community/netbox/commit/7c74d2ca657e3ed019abfee0230c59e3b425fd3c) Convert interface models to use NaturalOrderingField ### 📊 Changes **13 files changed** (+704 additions, -201 deletions) <details> <summary>View changed files</summary> 📝 `docs/release-notes/version-2.7.md` (+1 -0) 📝 `netbox/dcim/managers.py` (+1 -55) ➕ `netbox/dcim/migrations/0093_device_component_ordering.py` (+147 -0) ➕ `netbox/dcim/migrations/0094_device_component_template_ordering.py` (+138 -0) ➕ `netbox/dcim/migrations/0095_primary_model_ordering.py` (+70 -0) ➕ `netbox/dcim/migrations/0096_interface_ordering.py` (+53 -0) 📝 `netbox/dcim/models/__init__.py` (+29 -20) 📝 `netbox/dcim/models/device_component_templates.py` (+62 -37) 📝 `netbox/dcim/models/device_components.py` (+72 -41) 📝 `netbox/dcim/tables.py` (+18 -3) 📝 `netbox/utilities/fields.py` (+33 -0) ➖ `netbox/utilities/managers.py` (+0 -45) ➕ `netbox/utilities/ordering.py` (+80 -0) </details> ### 📄 Description ### Fixes: #3799 - Introduce NaturalOrderingField for storing pre-rendered natural ordering-friendly values on models - Introduce `naturalize()` and `naturalize_interface()` to handle generating values suitable for natural ordering - Add a NaturalOrderingField (`_name`) to the site, rack, and device models, as well as all device components and component templates - Extend schema migrations to automatically generate naturalized values for existing objects - Remove NaturalOrderingManager - Remove custom ordering logic from InterfaceManager --- <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-29 22:23:28 +01:00
adam closed this issue 2025-12-29 22:23:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12762