diff --git a/CHANGELOG.md b/CHANGELOG.md index 2241708..f73fba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fix installation form submission on NetBox v4.6.5 when form mixins return no cleaned-data value * Prevent the notification log creation flag from shadowing Django's translation function during email delivery * Use NetBox's configured `EMAIL['FROM_EMAIL']` value as the SMTP sender instead of Django's localhost fallback +* Register the expiration event with a concrete string so NetBox 4.6 can render the notification dropdown ### Added diff --git a/netbox_slm/__init__.py b/netbox_slm/__init__.py index fff3279..8342845 100644 --- a/netbox_slm/__init__.py +++ b/netbox_slm/__init__.py @@ -15,9 +15,9 @@ limitations under the License. """ from netbox.plugins import PluginConfig -from django.utils.translation import gettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ -__version__ = "1.12.3" +__version__ = "1.12.4" class SLMConfig(PluginConfig): @@ -42,7 +42,7 @@ class SLMConfig(PluginConfig): from netbox.events import EVENT_TYPE_KIND_WARNING, EventType from netbox_slm.events import LICENSE_EXPIRING - EventType(LICENSE_EXPIRING, _("License expiring"), kind=EVENT_TYPE_KIND_WARNING).register() + EventType(LICENSE_EXPIRING, gettext("License expiring"), kind=EVENT_TYPE_KIND_WARNING).register() from netbox_slm import jobs # noqa: F401 diff --git a/netbox_slm/tests/test_models.py b/netbox_slm/tests/test_models.py index 67fd015..b978e4c 100644 --- a/netbox_slm/tests/test_models.py +++ b/netbox_slm/tests/test_models.py @@ -189,7 +189,8 @@ class ModelTestCase(SlmBaseTestCase): runner.run() runner.run() - self.assertEqual(1, Notification.objects.filter(user=user, object_id=license.pk).count()) + notification = Notification.objects.get(user=user, object_id=license.pk) + self.assertIsInstance(str(notification.event), str) self.assertEqual(1, SoftwareLicenseNotificationLog.objects.filter(user=user, license=license).count()) send_mail.assert_called_once() self.assertEqual("netbox@example.com", send_mail.call_args.args[2])