question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Locations are not sorted naturally

See original GitHub issue

NetBox version

2.11.0

Python version

3.7

Steps to Reproduce

  1. Create a Location named ‘Floor 2’
  2. Create a Location named ‘Floor 10’

Expected Behavior

In areas where Locations are displayed (e.g. /dcim/locations, /dcim/sites/N/), I would expect Floor 2 to be sorted prior to Floor 10.

Observed Behavior

Floor 10 is sorted prior to Floor 2.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremystretchcommented, Jul 27, 2021

Unfortunately we can’t rely on sorting in Python: It needs to be done at the database level. We do have some natural ordering in place for other models as mentioned above, however the use of MPTT for locations complicates things a bit. If we do end up removing MPTT under #6587 that should unblock this issue.

1reaction
jeremystretchcommented, Jun 22, 2021

Marking this as blocked by #6587

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netbox v3.2.2 - Location Sorting by Name (NOT Natural sorting)
2.2 - Location Sorting by Name (NOT Natural sorting) Locations does not/can't sort by name. This ruins the 'view' of nested locations.
Read more >
Naturally sorting Pandas DataFrame - python - Stack Overflow
Using sort_values for pandas >= 1.1.0. With the new key argument in DataFrame.sort_values , since pandas 1.1.0 , we can directly sort a ......
Read more >
Sorting for Humans : Natural Sort Order - Coding Horror
There are a few places you can find natural sort algorithms, however: ... Kate's lesson in mind: ASCIIbetical does not equal alphabetical.
Read more >
MySQL Natural Sorting with ORDER BY clause
In this tutorial, you will learn about some natural sorting techniques in MySQL using the ORDER BY clause.
Read more >
Object Ordering (The Java™ Tutorials > Collections > Interfaces)
Comparable implementations provide a natural ordering for a class, which allows ... If you try to sort a list, the elements of which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found