-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Closes #13283: Add context to dropdown options #15104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Tested it out locally and apart from the one piece I identified above it works amazingly.
Should we extend this to the plugin forms as well? I don't think the optional_attrs mechanism would work with that until we extend it.
netbox/dcim/forms/model_forms.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I noticed (I don't think it is a problem but something we might want to keep in mind) is when something is selected already it doesn't have those option_attrs populated (ex: editing a device, the current device type is missing the parent)
Not sure I follow; why wouldn't this work with plugins? It's the same |
Sorry, meant scripts, where we use custom classes (ObjectVar, MultiObjectVar). |
Ah that's a good point; yes, we should expose it somehow. To be honest I'm not a fan of the name |
Fixes: #13283
option_attrs
keyword argument on dynamic choice form fields that can be used to override default/undefined fields