mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -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 import reverse
|
||||||
|
from django.urls.exceptions import NoReverseMatch
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from core.models import ObjectType
|
from core.models import ObjectType
|
||||||
@ -42,7 +43,10 @@ class ObjectAction:
|
|||||||
kwargs = {
|
kwargs = {
|
||||||
kwarg: getattr(obj, kwarg) for kwarg in cls.url_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
|
@classmethod
|
||||||
def get_context(cls, context, obj):
|
def get_context(cls, context, obj):
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
<button type="submit" name="_rename" {% formaction %}="{{ url }}" class="btn btn-yellow">
|
{% if url %}
|
||||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
|
<button type="submit" name="_rename" {% formaction %}="{{ url }}" class="btn btn-yellow">
|
||||||
</button>
|
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user