-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend the use of natural ordering to additional models #11279
Comments
IMO it doesn't make sense to do this only for clusters as a discrete goal. For instance, #10644 proposes also implementing natural ordering for circuits. We use natural ordering for a few models in NetBox currently; namely sites, racks, devices, device components, VMs, and VM interfaces. This is accomplished by including a "hidden" While I'm not opposed to enabling natural ordering on other models, if we decide to do so, we should:
|
Maybe we can use postgres collation as there is support for natural ordering. We would have to create the collation in a migration with raw sql I assume, like: CREATE COLLATION natural_sort (provider = icu, locale = 'en@colNumeric=yes'); And then the collation can be specified on the field like: name = models.CharField(
max_length=100,
db_collation='numeric'
) It also seems possible to specify it at query time. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide. |
Collation definitely seems like the path forward, if it proves feasible. I recall going down this road a bit in the past but ran into limitations on older PostgreSQL versions. Django 4.2 drops support for PostgreSQL 11 (see #12237), so maybe that will free us up some? |
…8009) * 11279 add collation * 11279 add collation * 11279 add collation * 11279 add collation * 11279 fix tables /tests * 11279 fix tests * 11279 refactor VirtualDisk * Clean up migrations * Misc cleanup * Correct errant file inclusion --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
NetBox version
v3.4.1
Feature type
Data model extension
Proposed functionality
Extend Virtualisation Cluster model to use natualsorting by the cluster name.
Use case
Better sorting of the clusters without padding the numbers in the name.
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: