mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 03:27:21 -06:00
Refactor clone_button() to avoid undefined URL
This commit is contained in:
parent
86956c8fc3
commit
9f4c1e64ce
@ -27,12 +27,12 @@ def _get_viewname(instance, action):
|
||||
|
||||
@register.inclusion_tag('buttons/clone.html')
|
||||
def clone_button(instance):
|
||||
viewname = _get_viewname(instance, 'add')
|
||||
url = reverse(_get_viewname(instance, 'add'))
|
||||
|
||||
# Populate cloned field values
|
||||
param_string = prepare_cloned_fields(instance)
|
||||
if param_string:
|
||||
url = '{}?{}'.format(reverse(viewname), param_string)
|
||||
url = f'{url}?{param_string}'
|
||||
|
||||
return {
|
||||
'url': url,
|
||||
|
Loading…
Reference in New Issue
Block a user