[PR #3412] [MERGED] Move device component creation logic out of Device model #12558

Closed
opened 2025-12-29 22:22:15 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3412
Author: @jeremystretch
Created: 8/7/2019
Status: Merged
Merged: 8/9/2019
Merged by: @jeremystretch

Base: developHead: 3405-bugfix


📝 Commits (3)

📊 Changes

3 files changed (+224 additions, -30 deletions)

View changed files

📝 CHANGELOG.md (+8 -0)
📝 netbox/dcim/models.py (+85 -29)
📝 netbox/dcim/tests/test_models.py (+131 -1)

📄 Description

Fixes: #3405

Move the logic for automatic creation of components on new devices from the Device model to the individual component templates models, via an instantiate() method. This helps ensure that new fields are incorporated as they are added to the models.

Also adds a test to validate automatic component instantiation when a new device is created.


🔄 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/3412 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 8/7/2019 **Status:** ✅ Merged **Merged:** 8/9/2019 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `3405-bugfix` --- ### 📝 Commits (3) - [`86cd044`](https://github.com/netbox-community/netbox/commit/86cd044a68fe4c0310be82c67b27888d25b39393) Fixes #3405: Move device component creation logic into template models - [`605be30`](https://github.com/netbox-community/netbox/commit/605be30fb2d0107b9536f8a1f99716f58417ccc7) Add test for device component creation - [`0516aec`](https://github.com/netbox-community/netbox/commit/0516aecb0314046f130c0907a619f14640e99113) Changelog for #3405 ### 📊 Changes **3 files changed** (+224 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+8 -0) 📝 `netbox/dcim/models.py` (+85 -29) 📝 `netbox/dcim/tests/test_models.py` (+131 -1) </details> ### 📄 Description ### Fixes: #3405 Move the logic for automatic creation of components on new devices from the Device model to the individual component templates models, via an `instantiate()` method. This helps ensure that new fields are incorporated as they are added to the models. Also adds a test to validate automatic component instantiation when a new device is created. --- <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-29 22:22:15 +01:00
adam closed this issue 2025-12-29 22:22:15 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12558