[PR #5308] [MERGED] Fixes #5271: Extend DynamicModelChoiceMixin to accept initial field values implied by child fields #13004

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5308
Author: @jeremystretch
Created: 11/4/2020
Status: Merged
Merged: 11/4/2020
Merged by: @jeremystretch

Base: developHead: 5271-DynamicModelChoiceMixin-initial


📝 Commits (3)

  • 1f0b1dd Add initial_params to DynamicModelChoiceMixin
  • 7598b89 Add initial_params to all forms
  • 798220c Fix filter reference

📊 Changes

6 files changed (+52 additions, -85 deletions)

View changed files

📝 netbox/dcim/forms.py (+19 -33)
📝 netbox/dcim/tests/test_forms.py (+0 -17)
📝 netbox/ipam/forms.py (+11 -12)
📝 netbox/tenancy/forms.py (+4 -12)
📝 netbox/utilities/forms/fields.py (+14 -2)
📝 netbox/virtualization/forms.py (+4 -9)

📄 Description

Fixes: #5271

  • Adds the initial_params kwarg to DynamicModelChoiceMixin, which allows a field to infer its default initial value from the initial value of a child field
  • Set initial_params on all appropriate instances and remove relevant logic from __init__()

🔄 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/5308 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 11/4/2020 **Status:** ✅ Merged **Merged:** 11/4/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `5271-DynamicModelChoiceMixin-initial` --- ### 📝 Commits (3) - [`1f0b1dd`](https://github.com/netbox-community/netbox/commit/1f0b1dd10e5eeb643ebc6a56aaefe8f2821a405b) Add initial_params to DynamicModelChoiceMixin - [`7598b89`](https://github.com/netbox-community/netbox/commit/7598b891c1e356a0df77850b50877f9340e235d3) Add initial_params to all forms - [`798220c`](https://github.com/netbox-community/netbox/commit/798220cf9a7e9de7a3b859e762e122aaa457749e) Fix filter reference ### 📊 Changes **6 files changed** (+52 additions, -85 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms.py` (+19 -33) 📝 `netbox/dcim/tests/test_forms.py` (+0 -17) 📝 `netbox/ipam/forms.py` (+11 -12) 📝 `netbox/tenancy/forms.py` (+4 -12) 📝 `netbox/utilities/forms/fields.py` (+14 -2) 📝 `netbox/virtualization/forms.py` (+4 -9) </details> ### 📄 Description ### Fixes: #5271 - Adds the `initial_params` kwarg to DynamicModelChoiceMixin, which allows a field to infer its default initial value from the initial value of a child field - Set `initial_params` on all appropriate instances and remove relevant logic from `__init__()` --- <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:24:51 +01:00
adam closed this issue 2025-12-29 22:24:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13004