1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #412: Tenant group assignment is no longer mandatory

This commit is contained in:
Jeremy Stretch
2016-08-02 16:04:25 -04:00
parent 9f3647cd53
commit bc9158a74f
5 changed files with 54 additions and 7 deletions

View File

@@ -99,9 +99,10 @@ class TenantBulkEditView(PermissionRequiredMixin, BulkEditView):
def update_objects(self, pk_list, form):
fields_to_update = {}
for field in ['group']:
if form.cleaned_data[field]:
fields_to_update[field] = form.cleaned_data[field]
if form.cleaned_data['group'] == 0:
fields_to_update['group'] = None
elif form.cleaned_data['group']:
fields_to_update['group'] = form.cleaned_data['group']
return self.cls.objects.filter(pk__in=pk_list).update(**fields_to_update)