mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-24 02:11:50 +01:00
Fix accessor shadowing in WirelessLinkInterfacePanel
Rename __init__ parameter from 'accessor' to 'interface_attr' to avoid shadowing ObjectPanel.accessor, which would cause super().get_context() to resolve the wrong context key.
This commit is contained in:
@@ -28,16 +28,16 @@ class WirelessAuthenticationPanel(panels.ObjectAttributesPanel):
|
||||
class WirelessLinkInterfacePanel(panels.ObjectPanel):
|
||||
template_name = 'wireless/panels/wirelesslink_interface.html'
|
||||
|
||||
def __init__(self, accessor, title, **kwargs):
|
||||
def __init__(self, interface_attr, title, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.accessor = accessor
|
||||
self.interface_attr = interface_attr
|
||||
self.title = title
|
||||
|
||||
def get_context(self, context):
|
||||
obj = context['object']
|
||||
return {
|
||||
**super().get_context(context),
|
||||
'interface': getattr(obj, self.accessor),
|
||||
'interface': getattr(obj, self.interface_attr),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user