mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added bulk import view for tenant groups
This commit is contained in:
@ -53,7 +53,7 @@
|
|||||||
{% if perms.tenancy.add_tenantgroup %}
|
{% if perms.tenancy.add_tenantgroup %}
|
||||||
<div class="buttons pull-right">
|
<div class="buttons pull-right">
|
||||||
<a href="{% url 'tenancy:tenantgroup_add' %}" class="btn btn-xs btn-success" title="Add"><i class="fa fa-plus"></i></a>
|
<a href="{% url 'tenancy:tenantgroup_add' %}" class="btn btn-xs btn-success" title="Add"><i class="fa fa-plus"></i></a>
|
||||||
<a class="btn btn-xs btn-info disabled" title="Import"><i class="fa fa-download"></i></a>
|
<a href="{% url 'tenancy:tenantgroup_import' %}" class="btn btn-xs btn-info" title="Import"><i class="fa fa-download"></i></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'tenancy:tenantgroup_list' %}">Tenant Groups</a>
|
<a href="{% url 'tenancy:tenantgroup_list' %}">Tenant Groups</a>
|
||||||
|
@ -22,6 +22,17 @@ class TenantGroupForm(BootstrapMixin, forms.ModelForm):
|
|||||||
fields = ['name', 'slug']
|
fields = ['name', 'slug']
|
||||||
|
|
||||||
|
|
||||||
|
class TenantGroupCSVForm(forms.ModelForm):
|
||||||
|
slug = SlugField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = TenantGroup
|
||||||
|
fields = ['name', 'slug']
|
||||||
|
help_texts = {
|
||||||
|
'name': 'Group name',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tenants
|
# Tenants
|
||||||
#
|
#
|
||||||
|
@ -11,6 +11,7 @@ urlpatterns = [
|
|||||||
# Tenant groups
|
# Tenant groups
|
||||||
url(r'^tenant-groups/$', views.TenantGroupListView.as_view(), name='tenantgroup_list'),
|
url(r'^tenant-groups/$', views.TenantGroupListView.as_view(), name='tenantgroup_list'),
|
||||||
url(r'^tenant-groups/add/$', views.TenantGroupCreateView.as_view(), name='tenantgroup_add'),
|
url(r'^tenant-groups/add/$', views.TenantGroupCreateView.as_view(), name='tenantgroup_add'),
|
||||||
|
url(r'^tenant-groups/import/$', views.TenantGroupBulkImportView.as_view(), name='tenantgroup_import'),
|
||||||
url(r'^tenant-groups/delete/$', views.TenantGroupBulkDeleteView.as_view(), name='tenantgroup_bulk_delete'),
|
url(r'^tenant-groups/delete/$', views.TenantGroupBulkDeleteView.as_view(), name='tenantgroup_bulk_delete'),
|
||||||
url(r'^tenant-groups/(?P<slug>[\w-]+)/edit/$', views.TenantGroupEditView.as_view(), name='tenantgroup_edit'),
|
url(r'^tenant-groups/(?P<slug>[\w-]+)/edit/$', views.TenantGroupEditView.as_view(), name='tenantgroup_edit'),
|
||||||
|
|
||||||
|
@ -40,6 +40,13 @@ class TenantGroupEditView(TenantGroupCreateView):
|
|||||||
permission_required = 'tenancy.change_tenantgroup'
|
permission_required = 'tenancy.change_tenantgroup'
|
||||||
|
|
||||||
|
|
||||||
|
class TenantGroupBulkImportView(PermissionRequiredMixin, BulkImportView):
|
||||||
|
permission_required = 'tenancy.add_tenantgroup'
|
||||||
|
model_form = forms.TenantGroupCSVForm
|
||||||
|
table = tables.TenantGroupTable
|
||||||
|
default_return_url = 'tenancy:tenantgroup_list'
|
||||||
|
|
||||||
|
|
||||||
class TenantGroupBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
|
class TenantGroupBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
|
||||||
permission_required = 'tenancy.delete_tenantgroup'
|
permission_required = 'tenancy.delete_tenantgroup'
|
||||||
cls = TenantGroup
|
cls = TenantGroup
|
||||||
|
Reference in New Issue
Block a user