Improve handling of editing objects assignments with generic foreign #5809

Closed
opened 2025-12-29 19:33:00 +01:00 by adam · 4 comments
Owner

Originally created by @DanSheps on GitHub (Dec 20, 2021).

Proposed Changes

Improve the editing of objects which can be assigned to multiple different models (example: IPAddress can be assigned to a Interface, VMInterface or FHRPGroup).

Research still needs to be done to determine the best path forward

Justification

Currently, on a few models, we support assigning multiple objects using a Generic Foreign Key. To handle this, all form fields are loaded as individual fields (interface, vminterface, etc) and then handled in the clean/save/init functions to map them to the proper assigned_object GFK.

This can cause problems with form validation when all assigned objects are selected either 1 is used or a error is returned.

Originally created by @DanSheps on GitHub (Dec 20, 2021). ### Proposed Changes Improve the editing of objects which can be assigned to multiple different models (example: IPAddress can be assigned to a Interface, VMInterface or FHRPGroup). Research still needs to be done to determine the best path forward ### Justification Currently, on a few models, we support assigning multiple objects using a Generic Foreign Key. To handle this, all form fields are loaded as individual fields (interface, vminterface, etc) and then handled in the clean/save/init functions to map them to the proper assigned_object GFK. This can cause problems with form validation when all assigned objects are selected either 1 is used or a error is returned.
adam added the pending closuretype: housekeeping labels 2025-12-29 19:33:00 +01:00
adam closed this issue 2025-12-29 19:33:00 +01:00
Author
Owner

@DanSheps commented on GitHub (Dec 20, 2021):

A random thought:

  • Initialize the form with the assigned object
  • Determine type of assigned object to display
  • Use HTMX when switching the assigned object type
@DanSheps commented on GitHub (Dec 20, 2021): A random thought: * Initialize the form with the assigned object * Determine type of assigned object to display * Use HTMX when switching the assigned object type
Author
Owner

@DanSheps commented on GitHub (Dec 20, 2021):

Models that this would impact:

  • IPAddress
  • VLANGroup
@DanSheps commented on GitHub (Dec 20, 2021): Models that this would impact: * IPAddress * VLANGroup
Author
Owner

@github-actions[bot] commented on GitHub (Feb 19, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Feb 19, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Mar 21, 2022):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Mar 21, 2022): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5809