Add sort by Display Name in Rack Elevations #7253

Closed
opened 2025-12-29 20:20:54 +01:00 by adam · 1 comment
Owner

Originally created by @k0ste on GitHub (Nov 18, 2022).

NetBox version

v3.3.7

Python version

3.10

Steps to Reproduce

  1. Go to Rack Elevations
  2. Make query
  3. If your rack's naming like 3.7.3, 3.7.11, 3.8.2 - ordering by name may be not as expected by human

Expected Behavior

Ordering like this is expected by human: all 3.7.x racks, then 3.8.x racks...

{
    "count": 43,
    "next": "https://netbox.example.com/api/dcim/racks/?brief=1&limit=10&offset=10&ordering=display&tag=vpc-ru-7a",
    "previous": null,
    "results": [
        {
            "id": 2716,
            "url": "https://netbox.example.com/api/dcim/racks/2716/",
            "display": "3.7.3",
            "name": "3.7.3",
            "device_count": 19
        },
        {
            "id": 2717,
            "url": "https://netbox.example.com/api/dcim/racks/2717/",
            "display": "3.7.4",
            "name": "3.7.4",
            "device_count": 19
        },
        {
            "id": 2718,
            "url": "https://netbox.example.com/api/dcim/racks/2718/",
            "display": "3.7.5",
            "name": "3.7.5",
            "device_count": 20
        },
        {
            "id": 2719,
            "url": "https://netbox.example.com/api/dcim/racks/2719/",
            "display": "3.7.6",
            "name": "3.7.6",
            "device_count": 21
        },
        {
            "id": 2720,
            "url": "https://netbox.example.com/api/dcim/racks/2720/",
            "display": "3.7.7",
            "name": "3.7.7",
            "device_count": 20
        },
        {
            "id": 2721,
            "url": "https://netbox.example.com/api/dcim/racks/2721/",
            "display": "3.7.8",
            "name": "3.7.8",
            "device_count": 23
        },
        {
            "id": 2722,
            "url": "https://netbox.example.com/api/dcim/racks/2722/",
            "display": "3.7.9",
            "name": "3.7.9",
            "device_count": 23
        },
        {
            "id": 2723,
            "url": "https://netbox.example.com/api/dcim/racks/2723/",
            "display": "3.7.10",
            "name": "3.7.10",
            "device_count": 22
        },
        {
            "id": 2724,
            "url": "https://netbox.example.com/api/dcim/racks/2724/",
            "display": "3.7.11",
            "name": "3.7.11",
            "device_count": 23
        },
        {
            "id": 2725,
            "url": "https://netbox.example.com/api/dcim/racks/2725/",
            "display": "3.7.12",
            "name": "3.7.12",
            "device_count": 22
        }
    ]
}

Observed Behavior

Ordering by name works not as expected

{
    "count": 43,
    "next": "https://netbox.example.com/api/dcim/racks/?brief=1&limit=10&offset=10&ordering=name&tag=vpc-ru-7a",
    "previous": null,
    "results": [
        {
            "id": 1729,
            "url": "https://netbox.example.com/api/dcim/racks/1729/",
            "display": "3.14.18",
            "name": "3.14.18",
            "device_count": 19
        },
        {
            "id": 1730,
            "url": "https://netbox.example.com/api/dcim/racks/1730/",
            "display": "3.14.19",
            "name": "3.14.19",
            "device_count": 16
        },
        {
            "id": 1731,
            "url": "https://netbox.example.com/api/dcim/racks/1731/",
            "display": "3.14.20",
            "name": "3.14.20",
            "device_count": 18
        },
        {
            "id": 1732,
            "url": "https://netbox.example.com/api/dcim/racks/1732/",
            "display": "3.14.21",
            "name": "3.14.21",
            "device_count": 18
        },
        {
            "id": 1733,
            "url": "https://netbox.example.com/api/dcim/racks/1733/",
            "display": "3.14.22",
            "name": "3.14.22",
            "device_count": 18
        },
        {
            "id": 1734,
            "url": "https://netbox.example.com/api/dcim/racks/1734/",
            "display": "3.14.23",
            "name": "3.14.23",
            "device_count": 17
        },
        {
            "id": 1735,
            "url": "https://netbox.example.com/api/dcim/racks/1735/",
            "display": "3.14.24",
            "name": "3.14.24",
            "device_count": 18
        },
        {
            "id": 1736,
            "url": "https://netbox.example.com/api/dcim/racks/1736/",
            "display": "3.14.25",
            "name": "3.14.25",
            "device_count": 17
        },
        {
            "id": 2723,
            "url": "https://netbox.example.com/api/dcim/racks/2723/",
            "display": "3.7.10",
            "name": "3.7.10",
            "device_count": 22
        },
        {
            "id": 2724,
            "url": "https://netbox.example.com/api/dcim/racks/2724/",
            "display": "3.7.11",
            "name": "3.7.11",
            "device_count": 23
        }
    ]
}
Originally created by @k0ste on GitHub (Nov 18, 2022). ### NetBox version v3.3.7 ### Python version 3.10 ### Steps to Reproduce 1. Go to Rack Elevations 2. Make query 3. If your rack's naming like 3.7.3, 3.7.11, 3.8.2 - ordering by `name` may be not as expected by human ### Expected Behavior Ordering like this is expected by human: all 3.7.x racks, then 3.8.x racks... ```json { "count": 43, "next": "https://netbox.example.com/api/dcim/racks/?brief=1&limit=10&offset=10&ordering=display&tag=vpc-ru-7a", "previous": null, "results": [ { "id": 2716, "url": "https://netbox.example.com/api/dcim/racks/2716/", "display": "3.7.3", "name": "3.7.3", "device_count": 19 }, { "id": 2717, "url": "https://netbox.example.com/api/dcim/racks/2717/", "display": "3.7.4", "name": "3.7.4", "device_count": 19 }, { "id": 2718, "url": "https://netbox.example.com/api/dcim/racks/2718/", "display": "3.7.5", "name": "3.7.5", "device_count": 20 }, { "id": 2719, "url": "https://netbox.example.com/api/dcim/racks/2719/", "display": "3.7.6", "name": "3.7.6", "device_count": 21 }, { "id": 2720, "url": "https://netbox.example.com/api/dcim/racks/2720/", "display": "3.7.7", "name": "3.7.7", "device_count": 20 }, { "id": 2721, "url": "https://netbox.example.com/api/dcim/racks/2721/", "display": "3.7.8", "name": "3.7.8", "device_count": 23 }, { "id": 2722, "url": "https://netbox.example.com/api/dcim/racks/2722/", "display": "3.7.9", "name": "3.7.9", "device_count": 23 }, { "id": 2723, "url": "https://netbox.example.com/api/dcim/racks/2723/", "display": "3.7.10", "name": "3.7.10", "device_count": 22 }, { "id": 2724, "url": "https://netbox.example.com/api/dcim/racks/2724/", "display": "3.7.11", "name": "3.7.11", "device_count": 23 }, { "id": 2725, "url": "https://netbox.example.com/api/dcim/racks/2725/", "display": "3.7.12", "name": "3.7.12", "device_count": 22 } ] } ``` ### Observed Behavior Ordering by `name` works not as expected ```json { "count": 43, "next": "https://netbox.example.com/api/dcim/racks/?brief=1&limit=10&offset=10&ordering=name&tag=vpc-ru-7a", "previous": null, "results": [ { "id": 1729, "url": "https://netbox.example.com/api/dcim/racks/1729/", "display": "3.14.18", "name": "3.14.18", "device_count": 19 }, { "id": 1730, "url": "https://netbox.example.com/api/dcim/racks/1730/", "display": "3.14.19", "name": "3.14.19", "device_count": 16 }, { "id": 1731, "url": "https://netbox.example.com/api/dcim/racks/1731/", "display": "3.14.20", "name": "3.14.20", "device_count": 18 }, { "id": 1732, "url": "https://netbox.example.com/api/dcim/racks/1732/", "display": "3.14.21", "name": "3.14.21", "device_count": 18 }, { "id": 1733, "url": "https://netbox.example.com/api/dcim/racks/1733/", "display": "3.14.22", "name": "3.14.22", "device_count": 18 }, { "id": 1734, "url": "https://netbox.example.com/api/dcim/racks/1734/", "display": "3.14.23", "name": "3.14.23", "device_count": 17 }, { "id": 1735, "url": "https://netbox.example.com/api/dcim/racks/1735/", "display": "3.14.24", "name": "3.14.24", "device_count": 18 }, { "id": 1736, "url": "https://netbox.example.com/api/dcim/racks/1736/", "display": "3.14.25", "name": "3.14.25", "device_count": 17 }, { "id": 2723, "url": "https://netbox.example.com/api/dcim/racks/2723/", "display": "3.7.10", "name": "3.7.10", "device_count": 22 }, { "id": 2724, "url": "https://netbox.example.com/api/dcim/racks/2724/", "display": "3.7.11", "name": "3.7.11", "device_count": 23 } ] } ```
adam closed this issue 2025-12-29 20:20:55 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2022):

Natural ordering is already supported for racks. If the current behavior does not meet your needs, please submit a feature request citing your specific desired implementation.

@jeremystretch commented on GitHub (Nov 18, 2022): Natural ordering is already supported for racks. If the current behavior does not meet your needs, please submit a [feature request](https://github.com/netbox-community/netbox/issues/new?assignees=&labels=type%3A+feature&template=feature_request.yaml) citing your specific desired implementation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7253