[PR #17583] [MERGED] Closes #17577: Reference ModelState when determining whether an object is being created #15129

Closed
opened 2025-12-30 00:20:10 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17583
Author: @jeremystretch
Created: 9/23/2024
Status: Merged
Merged: 9/24/2024
Merged by: @jeremystretch

Base: developHead: 17577-check-ModelState


📝 Commits (1)

  • be584f2 Closes #17577: Reference ModelState when determining whether an object is being created

📊 Changes

8 files changed (+13 additions, -13 deletions)

View changed files

📝 netbox/dcim/models/cables.py (+1 -1)
📝 netbox/dcim/models/device_component_templates.py (+1 -1)
📝 netbox/dcim/models/device_components.py (+3 -3)
📝 netbox/dcim/models/devices.py (+3 -3)
📝 netbox/dcim/models/racks.py (+2 -2)
📝 netbox/netbox/models/__init__.py (+1 -1)
📝 netbox/virtualization/models/clusters.py (+1 -1)
📝 netbox/virtualization/models/virtualmachines.py (+1 -1)

📄 Description

Closes: #17577

For every instance where we're currently evaluating whether self.pk is null to determine if an object is being created or updated, instead reference its _state attribute.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/17583 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 9/23/2024 **Status:** ✅ Merged **Merged:** 9/24/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17577-check-ModelState` --- ### 📝 Commits (1) - [`be584f2`](https://github.com/netbox-community/netbox/commit/be584f24df7f0077bc5d0944ff56626c52e7bd6c) Closes #17577: Reference ModelState when determining whether an object is being created ### 📊 Changes **8 files changed** (+13 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models/cables.py` (+1 -1) 📝 `netbox/dcim/models/device_component_templates.py` (+1 -1) 📝 `netbox/dcim/models/device_components.py` (+3 -3) 📝 `netbox/dcim/models/devices.py` (+3 -3) 📝 `netbox/dcim/models/racks.py` (+2 -2) 📝 `netbox/netbox/models/__init__.py` (+1 -1) 📝 `netbox/virtualization/models/clusters.py` (+1 -1) 📝 `netbox/virtualization/models/virtualmachines.py` (+1 -1) </details> ### 📄 Description ### Closes: #17577 For every instance where we're currently evaluating whether `self.pk` is null to determine if an object is being created or updated, instead reference its `_state` attribute. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:20:10 +01:00
adam closed this issue 2025-12-30 00:20:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15129