mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 12:22:23 -06:00
Closes #11693: Enable remote data synchronization for export templates
This commit is contained in:
6
netbox/utilities/templates/buttons/sync.html
Normal file
6
netbox/utilities/templates/buttons/sync.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<form action="{{ url }}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-primary btn-sm">
|
||||
<i class="mdi mdi-sync" aria-hidden="true"></i> Sync
|
||||
</button>
|
||||
</form>
|
||||
@@ -46,6 +46,16 @@ def delete_button(instance):
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('buttons/sync.html')
|
||||
def sync_button(instance):
|
||||
viewname = get_viewname(instance, 'sync')
|
||||
url = reverse(viewname, kwargs={'pk': instance.pk})
|
||||
|
||||
return {
|
||||
'url': url,
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# List buttons
|
||||
#
|
||||
|
||||
@@ -28,3 +28,8 @@ def can_change(user, instance):
|
||||
@register.filter()
|
||||
def can_delete(user, instance):
|
||||
return _check_permission(user, instance, 'delete')
|
||||
|
||||
|
||||
@register.filter()
|
||||
def can_sync(user, instance):
|
||||
return _check_permission(user, instance, 'sync')
|
||||
|
||||
Reference in New Issue
Block a user