Change Cable.status field from Boolean to Int type #2599

Closed
opened 2025-12-29 18:20:16 +01:00 by adam · 2 comments
Owner

Originally created by @Grokzen on GitHub (May 9, 2019).

Proposed Changes

The status field on the Cable model is the only status field across all models that is a Boolean type and not a Integer type. This makes it impossible to extend the status property on this model to include other statuses in the future. And it is not streamlined that all status fields is of the same type and works in the same way.

    status = models.BooleanField(
        choices=CONNECTION_STATUS_CHOICES,
        default=CONNECTION_STATUS_CONNECTED
    )

...

# Console/power/interface connection statuses
CONNECTION_STATUS_PLANNED = False
CONNECTION_STATUS_CONNECTED = True
CONNECTION_STATUS_CHOICES = [
    [CONNECTION_STATUS_PLANNED, 'Planned'],
    [CONNECTION_STATUS_CONNECTED, 'Connected'],
]

Justification

Streamline all status fields to the same type and make it possible to extend the status field.

Originally created by @Grokzen on GitHub (May 9, 2019). <!-- NOTE: This type of issue should be opened only by those reasonably familiar with NetBox's code base and interested in contributing to its development. Describe the proposed change(s) in detail. --> ### Proposed Changes The status field on the Cable model is the only status field across all models that is a Boolean type and not a Integer type. This makes it impossible to extend the status property on this model to include other statuses in the future. And it is not streamlined that all status fields is of the same type and works in the same way. ``` status = models.BooleanField( choices=CONNECTION_STATUS_CHOICES, default=CONNECTION_STATUS_CONNECTED ) ... # Console/power/interface connection statuses CONNECTION_STATUS_PLANNED = False CONNECTION_STATUS_CONNECTED = True CONNECTION_STATUS_CHOICES = [ [CONNECTION_STATUS_PLANNED, 'Planned'], [CONNECTION_STATUS_CONNECTED, 'Connected'], ] ``` <!-- Provide justification for the proposed change(s). --> ### Justification Streamline all status fields to the same type and make it possible to extend the status field.
adam closed this issue 2025-12-29 18:20:17 +01:00
Author
Owner

@yarnocobussen commented on GitHub (May 9, 2019):

Might be good to comment on this in https://github.com/digitalocean/netbox/issues/3145

@yarnocobussen commented on GitHub (May 9, 2019): Might be good to comment on this in https://github.com/digitalocean/netbox/issues/3145
Author
Owner

@jeremystretch commented on GitHub (May 9, 2019):

This would be covered by #3145 if accepted.

@jeremystretch commented on GitHub (May 9, 2019): This would be covered by #3145 if accepted.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2599