From 2927b8dae176d747ef09ae5eb7f3c4d0c3fe8759 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 1 Jul 2025 09:27:55 -0400 Subject: [PATCH] Bulk rename URL resolution should fail silently --- netbox/netbox/object_actions.py | 6 +++++- netbox/utilities/templates/buttons/bulk_rename.html | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/netbox/netbox/object_actions.py b/netbox/netbox/object_actions.py index b427d58cd..73315ce4c 100644 --- a/netbox/netbox/object_actions.py +++ b/netbox/netbox/object_actions.py @@ -1,4 +1,5 @@ from django.urls import reverse +from django.urls.exceptions import NoReverseMatch from django.utils.translation import gettext as _ from core.models import ObjectType @@ -42,7 +43,10 @@ class ObjectAction: kwargs = { kwarg: getattr(obj, kwarg) for kwarg in cls.url_kwargs } - return reverse(viewname, kwargs=kwargs) + try: + return reverse(viewname, kwargs=kwargs) + except NoReverseMatch: + return @classmethod def get_context(cls, context, obj): diff --git a/netbox/utilities/templates/buttons/bulk_rename.html b/netbox/utilities/templates/buttons/bulk_rename.html index 376faa88b..6e268cc62 100644 --- a/netbox/utilities/templates/buttons/bulk_rename.html +++ b/netbox/utilities/templates/buttons/bulk_rename.html @@ -1,3 +1,5 @@ - +{% if url %} + +{% endif %}