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

Fixes #527: Support for nullifying custom fields during bulk editing

This commit is contained in:
Jeremy Stretch
2016-10-05 15:17:17 -04:00
parent 8227a9ff9c
commit 73945899fe
3 changed files with 35 additions and 24 deletions

View File

@@ -296,9 +296,14 @@ class ConfirmationForm(forms.Form, BootstrapMixin):
class BulkEditForm(forms.Form):
def __init__(self, *args, **kwargs):
def __init__(self, model, *args, **kwargs):
super(BulkEditForm, self).__init__(*args, **kwargs)
self.nullable_fields = getattr(self.Meta, 'nullable_fields')
self.model = model
# Copy any nullable fields defined in Meta
if hasattr(self.Meta, 'nullable_fields'):
self.nullable_fields = [field for field in self.Meta.nullable_fields]
else:
self.nullable_fields = []
class BulkImportForm(forms.Form):