diff --git a/net-mgmt/py-phonebox-plugin/Makefile b/net-mgmt/py-phonebox-plugin/Makefile index 8befd177dd47..a7e22f06d40f 100644 --- a/net-mgmt/py-phonebox-plugin/Makefile +++ b/net-mgmt/py-phonebox-plugin/Makefile @@ -1,23 +1,24 @@ PORTNAME= phonebox-plugin DISTVERSION= 0.0.4b1 +PORTREVISION= 1 CATEGORIES= net-mgmt python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} DISTNAME= phonebox_plugin-${DISTVERSION} MAINTAINER= kai@FreeBSD.org COMMENT= Phone numbers management plugin for NetBox WWW= https://github.com/iDebugAll/phonebox_plugin LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE USES= python:3.6+ USE_PYTHON= autoplist distutils NO_ARCH= yes SUB_FILES= pkg-message SUB_LIST= PYTHON_VER=${PYTHON_VER} .include diff --git a/net-mgmt/py-phonebox-plugin/files/patch-fix-runtime-with-netbox-3.3-and-later b/net-mgmt/py-phonebox-plugin/files/patch-fix-runtime-with-netbox-3.3-and-later new file mode 100644 index 000000000000..b04dd8661c77 --- /dev/null +++ b/net-mgmt/py-phonebox-plugin/files/patch-fix-runtime-with-netbox-3.3-and-later @@ -0,0 +1,187 @@ +Fix runtime issues with NetBox 3.3+ + +See also: + +https://github.com/iDebugAll/phonebox_plugin/issues/27 +https://github.com/iDebugAll/phonebox_plugin/pull/28 + +--- MANIFEST.in.orig 2023-02-21 21:36:03 UTC ++++ MANIFEST.in +@@ -1,4 +1,5 @@ recursive-include phonebox_plugin/templates * + include README.md + include LICENSE + recursive-include phonebox_plugin/templates * ++recursive-exclude phonebox_plugin/templates *.orig .DS_Store + recursive-include phonebox_plugin/static * +--- phonebox_plugin/api/nested_serializers.py.orig 2021-09-21 14:31:12 UTC ++++ phonebox_plugin/api/nested_serializers.py +@@ -1,6 +1,12 @@ from phonebox_plugin import models + from rest_framework import serializers + from phonebox_plugin import models +-from netbox.api import WritableNestedSerializer ++ ++try: ++ from netbox.api import ChoiceField, WritableNestedSerializer ++except ImportError: ++ from netbox.api.fields import ChoiceField ++ from netbox.api.serializers.nested import WritableNestedSerializer ++ + from tenancy.api.nested_serializers import NestedTenantSerializer + + __all__ = ["NestedNumberSerializer", ] +--- phonebox_plugin/templates/phonebox_plugin/list_view_3.4.html.orig 2023-02-21 21:32:23 UTC ++++ phonebox_plugin/templates/phonebox_plugin/list_view_3.4.html +@@ -0,0 +1,62 @@ ++{% extends 'base/layout.html' %} ++{% load buttons %} ++{% load static %} ++{% load plugins %} ++{% load helpers %} ++ ++ ++{% block controls %} ++ ++
++ {% if perms.phonebox_plugin.add_number %} ++ ++ Add ++ ++ {% endif %} ++ {% if perms.phonebox_plugin.add_number %} ++ ++ Import ++ ++ {% endif %} ++
++ ++{% endblock %} ++ ++ ++{% block content %} ++ ++ ++ ++
++
++ ++ {# Applied filters #} ++ {% if filter_form %} ++ {% applied_filters model filter_form request.GET %} ++ {% endif %} ++ ++

{% block title %}Numbers{% endblock %}

++
++
++ {% include 'phonebox_plugin/obj_table.html' with bulk_delete_url="plugins:phonebox_plugin:number_bulk_delete" bulk_edit_url="plugins:phonebox_plugin:number_bulk_edit" %} ++
++
++
++
++ {% include 'inc/filter_list.html' %} ++
++
++ ++{% endblock %} +--- phonebox_plugin/templates/phonebox_plugin/voice_circuit_list_view_3.4.html.orig 2023-02-21 21:32:23 UTC ++++ phonebox_plugin/templates/phonebox_plugin/voice_circuit_list_view_3.4.html +@@ -0,0 +1,62 @@ ++{% extends 'base/layout.html' %} ++{% load buttons %} ++{% load static %} ++{% load plugins %} ++{% load helpers %} ++ ++ ++{% block controls %} ++ ++
++ {% if perms.phonebox_plugin.add_voice_circuit %} ++ ++ Add ++ ++ {% endif %} ++ {% if perms.phonebox_plugin.add_voice_circuit %} ++ ++ Import ++ ++ {% endif %} ++
++ ++{% endblock %} ++ ++ ++{% block content %} ++ ++ ++ ++
++
++ ++ {# Applied filters #} ++ {% if filter_form %} ++ {% applied_filters model filter_form request.GET %} ++ {% endif %} ++ ++

{% block title %}Voice Circuits{% endblock %}

++
++
++ {% include 'phonebox_plugin/obj_table.html' with bulk_delete_url="plugins:phonebox_plugin:voice_circuit_bulk_delete" bulk_edit_url="plugins:phonebox_plugin:voice_circuit_bulk_edit" %} ++
++
++
++
++ {% include 'inc/filter_list.html' %} ++
++
++ ++{% endblock %} +--- phonebox_plugin/views.py.orig 2022-06-09 10:46:13 UTC ++++ phonebox_plugin/views.py +@@ -18,8 +18,10 @@ class NumberListView(generic.ObjectListView): + filterset = filters.NumberFilterSet + filterset_form = forms.NumberFilterForm + table = tables.NumberTable +- if NETBOX_CURRENT_VERSION >= version.parse("3.0"): ++ if NETBOX_CURRENT_VERSION >= version.parse("3.0") and NETBOX_CURRENT_VERSION < version.parse("3.4"): + template_name = "phonebox_plugin/list_view_3.x.html" ++ elif NETBOX_CURRENT_VERSION >= version.parse("3.4"): ++ template_name = "phonebox_plugin/list_view_3.4.html" + else: + template_name = "phonebox_plugin/list_view.html" + +@@ -76,8 +78,10 @@ class VoiceCircuitListView(generic.ObjectListView): + filterset = filters.VoiceCircuitFilterSet + filterset_form = forms.VoiceCircuitFilterForm + table = tables.VoiceCircuitTable +- if NETBOX_CURRENT_VERSION >= version.parse("3.0"): ++ if NETBOX_CURRENT_VERSION >= version.parse("3.0") and NETBOX_CURRENT_VERSION < version.parse("3.4"): + template_name = "phonebox_plugin/voice_circuit_list_view_3.x.html" ++ elif NETBOX_CURRENT_VERSION >= version.parse("3.4"): ++ template_name = "phonebox_plugin/voice_circuit_list_view_3.4.html" + else: + template_name = "phonebox_plugin/voice_circuit_list_view.html" +