mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
implemnted #2392 - local config context for devices and VMs
This commit is contained in:
@@ -716,6 +716,10 @@ class ConfigContextModel(models.Model):
|
||||
for context in ConfigContext.objects.get_for_object(self):
|
||||
data.update(context.data)
|
||||
|
||||
# If the object has local config context data defined, that data overwrites all rendered data
|
||||
if self.local_config_context_data is not None:
|
||||
data.update(self.local_config_context_data)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
|
@@ -106,9 +106,15 @@ class ObjectConfigContextView(View):
|
||||
|
||||
obj = get_object_or_404(self.object_class, pk=pk)
|
||||
source_contexts = ConfigContext.objects.get_for_object(obj)
|
||||
model_name = self.object_class._meta.model_name
|
||||
app_label = self.object_class._meta.app_label
|
||||
|
||||
return render(request, 'extras/object_configcontext.html', {
|
||||
self.object_class._meta.model_name: obj,
|
||||
model_name: obj,
|
||||
'obj': obj,
|
||||
'perm_string': '{}.change_{}'.format(app_label, model_name),
|
||||
'edit_url':'{}:{}_edit_localconfigcontext'.format(app_label, model_name),
|
||||
'delete_url':'{}:{}_delete_localconfigcontext'.format(app_label, model_name),
|
||||
'rendered_context': obj.get_config_context(),
|
||||
'source_contexts': source_contexts,
|
||||
'base_template': self.base_template,
|
||||
|
Reference in New Issue
Block a user