mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-28 03:16:25 -06:00
Extend get_extra_context_data() to provide default data
This commit is contained in:
parent
221a5d7a94
commit
5d75e144b9
@ -2255,9 +2255,6 @@ class DeviceRenderConfigView(ObjectRenderConfigView):
|
|||||||
queryset = Device.objects.all()
|
queryset = Device.objects.all()
|
||||||
base_template = 'dcim/device/base.html'
|
base_template = 'dcim/device/base.html'
|
||||||
|
|
||||||
def get_extra_context_data(self, request, instance):
|
|
||||||
return {'device': instance}
|
|
||||||
|
|
||||||
|
|
||||||
@register_model_view(Device, 'virtual-machines')
|
@register_model_view(Device, 'virtual-machines')
|
||||||
class DeviceVirtualMachinesView(generic.ObjectChildrenView):
|
class DeviceVirtualMachinesView(generic.ObjectChildrenView):
|
||||||
|
@ -918,7 +918,9 @@ class ObjectRenderConfigView(generic.ObjectView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_extra_context_data(self, request, instance):
|
def get_extra_context_data(self, request, instance):
|
||||||
return {}
|
return {
|
||||||
|
f'{instance._meta.model_name}': instance,
|
||||||
|
}
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# Compile context data
|
# Compile context data
|
||||||
|
@ -429,9 +429,6 @@ class VirtualMachineRenderConfigView(ObjectRenderConfigView):
|
|||||||
queryset = VirtualMachine.objects.all()
|
queryset = VirtualMachine.objects.all()
|
||||||
base_template = 'virtualization/virtualmachine/base.html'
|
base_template = 'virtualization/virtualmachine/base.html'
|
||||||
|
|
||||||
def get_extra_context_data(self, request, instance):
|
|
||||||
return {'virtualmachine': instance}
|
|
||||||
|
|
||||||
|
|
||||||
@register_model_view(VirtualMachine, 'add', detail=False)
|
@register_model_view(VirtualMachine, 'add', detail=False)
|
||||||
@register_model_view(VirtualMachine, 'edit')
|
@register_model_view(VirtualMachine, 'edit')
|
||||||
|
Loading…
Reference in New Issue
Block a user