Skip to content
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

Updates for Netbox 4.0 fixes #11 #12

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netbox_powerdns_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from extras.plugins import PluginConfig
from netbox.plugins import PluginConfig
from .version import __version__


Expand Down
5 changes: 1 addition & 4 deletions netbox_powerdns_sync/navigation.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from extras.plugins import PluginMenuItem, PluginMenuButton
from utilities.choices import ButtonColorChoices
from netbox.plugins import PluginMenuItem, PluginMenuButton


apiserver_buttons = [
PluginMenuButton(
link='plugins:netbox_powerdns_sync:apiserver_add',
title='Add',
icon_class='mdi mdi-plus-thick',
color=ButtonColorChoices.GREEN
),
]

Expand All @@ -16,7 +14,6 @@
link='plugins:netbox_powerdns_sync:zone_add',
title='Add',
icon_class='mdi mdi-plus-thick',
color=ButtonColorChoices.GREEN
),
]

Expand Down
2 changes: 1 addition & 1 deletion netbox_powerdns_sync/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from core.models import Job
from dcim.models import Device, Interface
from extras.plugins.utils import get_plugin_config
from netbox.plugins.utils import get_plugin_config
from ipam.models import IPAddress, FHRPGroup
from netbox.context import current_request
from virtualization.models import VirtualMachine, VMInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

<p>
{% if job.started %}
Started: <strong>{{ job.started|annotated_date }}</strong>
Started: <strong>{{ job.started|isodatetime }}</strong>
{% elif job.scheduled %}
Scheduled for: <strong>{{ job.scheduled|annotated_date }}</strong> ({{ job.scheduled|naturaltime }})
Scheduled for: <strong>{{ job.scheduled|isodatetime }}</strong> ({{ job.scheduled|naturaltime }})
{% else %}
Created: <strong>{{ job.created|annotated_date }}</strong>
Created: <strong>{{ job.created|isodatetime }}</strong>
{% endif %}
{% if job.completed %}
Duration: <strong>{{ job.duration }}</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<nav class="breadcrumb-container px-3" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_powerdns_sync:sync_jobs' %}">Sync Jobs</a></li>
<li class="breadcrumb-item">{{ job.created|annotated_date }}</li>
<li class="breadcrumb-item">{{ job.created|isodatetime }}</li>
</ol>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion netbox_powerdns_sync/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.contrib.contenttypes.models import ContentType
from dcim.models import Device, Interface
from extras.choices import ObjectChangeActionChoices
from extras.plugins.utils import get_plugin_config
from netbox.plugins.utils import get_plugin_config
from extras.models import ObjectChange
from ipam.models import IPAddress
from virtualization.models import VirtualMachine, VMInterface
Expand Down
2 changes: 1 addition & 1 deletion netbox_powerdns_sync/views/api_servers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from netbox.views import generic
from utilities.utils import count_related
from utilities.query import count_related
from utilities.views import register_model_view

from .. import filtersets, forms, tables
Expand Down
5 changes: 2 additions & 3 deletions netbox_powerdns_sync/views/syncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import View
from core.models import Job
from utilities.htmx import is_htmx
from utilities.rqworker import get_workers_for_queue
from utilities.utils import normalize_querydict
from utilities.querydict import normalize_querydict
from utilities.views import ContentTypePermissionRequiredMixin

from ..constants import JOB_NAME_DEVICE, JOB_NAME_INTERFACE, JOB_NAME_IP, JOB_NAME_SYNC
Expand Down Expand Up @@ -88,7 +87,7 @@ def get(self, request, job_pk):
#script = module.scripts[job.name]()

# If this is an HTMX request, return only the result HTML
if is_htmx(request):
if request.htmx:
response = render(request, "netbox_powerdns_sync/htmx/sync_result.html", {
#"script": script,
"job": job,
Expand Down
2 changes: 1 addition & 1 deletion netbox_powerdns_sync/views/zones.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from netbox.views import generic
from utilities.utils import count_related
from utilities.query import count_related
from utilities.views import register_model_view

from .. import filtersets, forms, tables
Expand Down