Enable filtering devices by assigned rack face #1939

Closed
opened 2025-12-29 17:20:45 +01:00 by adam · 5 comments
Owner

Originally created by @ebusto on GitHub (Aug 14, 2018).

Environment

  • Python version: 3.5.4
  • NetBox version: 2.4.3

Proposed Functionality

Add the ability to search for devices based on rack position and face.

Use Case

It is handy to be able to search for devices in a specific part of a rack, which the combination of position and face should accomplish. I believe this is a trivial change to netbox/dcim/filters.py.

Database Changes

None.

External Dependencies

None.

Originally created by @ebusto on GitHub (Aug 14, 2018). ### Environment * Python version: 3.5.4 * NetBox version: 2.4.3 ### Proposed Functionality Add the ability to search for devices based on rack position and face. ### Use Case It is handy to be able to search for devices in a specific part of a rack, which the combination of position and face should accomplish. I believe this is a trivial change to `netbox/dcim/filters.py`. ### Database Changes None. ### External Dependencies None.
adam added the status: acceptedtype: feature labels 2025-12-29 17:20:45 +01:00
adam closed this issue 2025-12-29 17:20:45 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 16, 2018):

FYI position is already an available filter.

@jeremystretch commented on GitHub (Aug 16, 2018): FYI `position` is already an available filter.
Author
Owner

@jeremystretch commented on GitHub (Aug 21, 2018):

We may have painted ourselves into a corner with this one. The face is stored as a nullable integer value in the database, with 0 meaning front and 1 meaning rear (and null meaning neither). However, we're using 0 as a special value to represent null for filters, so querying ?face=0 will return only devices with no face assignment.

We have a few options:

  1. Change the face field to use different values (e.g. "front" and "rear") instead of 0 and 1. This requires a database migration.
  2. Use different values for the filter. I don't like this because it's inconsistent. For example, querying ?face=front will return a device which has face=0.
  3. Change the value used to represent null. While an argument can be made for this option, it's likely too disruptive to be justified.
@jeremystretch commented on GitHub (Aug 21, 2018): We may have painted ourselves into a corner with this one. The face is stored as a nullable integer value in the database, with `0` meaning front and `1` meaning rear (and `null` meaning neither). However, we're using `0` as a special value to represent null for filters, so querying `?face=0` will return only devices with no face assignment. We have a few options: 1. Change the `face` field to use different values (e.g. "front" and "rear") instead of 0 and 1. This requires a database migration. 2. Use different values for the filter. I don't like this because it's inconsistent. For example, querying `?face=front` will return a device which has `face=0`. 3. Change the value used to represent null. While an argument can be made for this option, it's likely too disruptive to be justified.
Author
Owner

@jeremystretch commented on GitHub (Nov 30, 2018):

Marking this as blocked by #2632

@jeremystretch commented on GitHub (Nov 30, 2018): Marking this as blocked by #2632
Author
Owner

@tb-killa commented on GitHub (Jan 8, 2019):

Hi I would ask if there is something new?
#2632 is closed and I like your idea of:

Change the face field to use different values (e.g. "front" and "rear") instead of 0 and 1.

@tb-killa commented on GitHub (Jan 8, 2019): Hi I would ask if there is something new? #2632 is closed and I like your idea of: Change the face field to use different values (e.g. "front" and "rear") instead of 0 and 1.
Author
Owner

@candlerb commented on GitHub (Jan 30, 2019):

@tb-killa: #2632 was closed because it was implemented in 2.5.0.

This opens the route to implementing a filter for face=0, face=1 and face=null, but I don't think that's been implemented yet (hence this ticket remains open)

@candlerb commented on GitHub (Jan 30, 2019): @tb-killa: #2632 was closed because it was implemented in 2.5.0. This opens the route to implementing a filter for `face=0`, `face=1` and `face=null`, but I don't think that's been implemented yet (hence this ticket remains open)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1939