mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 16:47:34 -06:00
Bulk rename URL resolution should fail silently
This commit is contained in:
parent
1333b964d9
commit
2927b8dae1
@ -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):
|
||||
|
@ -1,3 +1,5 @@
|
||||
<button type="submit" name="_rename" {% formaction %}="{{ url }}" class="btn btn-yellow">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
|
||||
</button>
|
||||
{% if url %}
|
||||
<button type="submit" name="_rename" {% formaction %}="{{ url }}" class="btn btn-yellow">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user