-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
53 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
from django import forms | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from django.db import models | ||
from django.urls import reverse | ||
from netbox.models import NetBoxModel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
import django_tables2 as tables | ||
from netbox.tables import NetBoxTable, ChoiceFieldColumn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
from netbox.plugins import PluginTemplateExtension | ||
from .utilities.html_differ import styled_diff | ||
|
||
class ChangeLogDiffTemplateExtension(PluginTemplateExtension): | ||
model = 'extras.objectchange' | ||
|
||
class ChangeLogDiffTemplateExtension(PluginTemplateExtension): | ||
model = "extras.objectchange" | ||
|
||
def full_width_page(self): | ||
prechange_data = self.context['object'].prechange_data | ||
postchange_data = self.context['object'].postchange_data | ||
prechange_data = self.context["object"].prechange_data | ||
postchange_data = self.context["object"].postchange_data | ||
|
||
leftrightdiffhtml = styled_diff( | ||
prechange_data or dict(), | ||
prechange_data or dict(), | ||
postchange_data or dict(), | ||
) | ||
return self.render('netbox_changelog_diff_plugin/changelogdiff.html', | ||
extra_context={ | ||
'leftrightdiffhtml': leftrightdiffhtml | ||
}) | ||
return self.render( | ||
"netbox_changelog_diff_plugin/changelogdiff.html", extra_context={"leftrightdiffhtml": leftrightdiffhtml} | ||
) | ||
|
||
|
||
template_extensions = [ChangeLogDiffTemplateExtension] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
from netbox.views.generic import ObjectChangeLogView | ||
|
||
|
||
urlpatterns = [] | ||
urlpatterns = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from django.conf import settings | ||
|
||
|
||
def get_plugin_setting(setting_name): | ||
plugin_settings = settings.PLUGINS_CONFIG['netbox_changelog_diff_plugin'] | ||
assert setting_name in plugin_settings, f'Setting {setting_name} not supported' | ||
return plugin_settings[setting_name] | ||
plugin_settings = settings.PLUGINS_CONFIG["netbox_changelog_diff_plugin"] | ||
assert setting_name in plugin_settings, f"Setting {setting_name} not supported" | ||
return plugin_settings[setting_name] |