Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15794 Make "related objects" dynamic #15876

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

alehaa
Copy link
Contributor

@alehaa alehaa commented Apr 28, 2024

Fixes: #15794

Instead of hardcoding relationships between models for the detail view, they are now dynamically generated.

Known limitations

  1. If a related model doesn't have a list view, rendering of the related objects pane will fail. This limitation was already present before, but related models listed were explicitly chosen to do so. For all views shipped with NetBox I've added a filter if needed (omit parameter). However, external plugins might trigger this unintentionally, when named view is not available, but the relationship has not been setup with related_name='+' parameter. Switching to verified_view in the panel's template should resolve this, but might decrease performance slightly.

  2. If a model introduces several relations to another model, they will all be listed with the same model name but different URL query parameters. This is not the case for models included in NetBox. As before, plugin developers can still use an extra panel for this special purpose and extra context about the different types of relationships.

Instead of hardcoding relationships between models for the detail view,
they are now dynamically generated.
jeremystretch and others added 3 commits May 9, 2024 13:50
Instead of providing a rarely used hook method, additional related
models can now be passed directly to the lookup method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the "Related Objects" pane of all models dynamic
2 participants