mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-27 01:36:11 -06:00
#12087 - Minor tweaks
This commit is contained in:
parent
0d5e98a38c
commit
18a1ae56f1
@ -507,14 +507,14 @@ class BulkEditView(GetReturnURLMixin, BaseMultiObjectView):
|
|||||||
for name in standard_fields:
|
for name in standard_fields:
|
||||||
try:
|
try:
|
||||||
model_field = self.queryset.model._meta.get_field(name)
|
model_field = self.queryset.model._meta.get_field(name)
|
||||||
if isinstance(model_field, ManyToManyField):
|
if isinstance(model_field, (ManyToManyField, ManyToManyRel)):
|
||||||
m2m_fields[name] = model_field
|
m2m_fields[name] = model_field
|
||||||
else:
|
else:
|
||||||
model_fields[name] = model_field
|
model_fields[name] = model_field
|
||||||
|
|
||||||
except FieldDoesNotExist:
|
except FieldDoesNotExist:
|
||||||
# This form field is used to modify a field rather than set its value directly
|
# This form field is used to modify a field rather than set its value directly
|
||||||
model_field = None
|
model_fields[name] = None
|
||||||
|
|
||||||
for obj in self.queryset.filter(pk__in=form.cleaned_data['pk']):
|
for obj in self.queryset.filter(pk__in=form.cleaned_data['pk']):
|
||||||
|
|
||||||
@ -526,7 +526,6 @@ class BulkEditView(GetReturnURLMixin, BaseMultiObjectView):
|
|||||||
for name, model_field in model_fields.items():
|
for name, model_field in model_fields.items():
|
||||||
# Handle nullification
|
# Handle nullification
|
||||||
if name in form.nullable_fields and name in nullified_fields:
|
if name in form.nullable_fields and name in nullified_fields:
|
||||||
if not isinstance(model_field, ManyToManyField):
|
|
||||||
setattr(obj, name, None if model_field.null else '')
|
setattr(obj, name, None if model_field.null else '')
|
||||||
# Normal fields
|
# Normal fields
|
||||||
elif name in form.changed_data:
|
elif name in form.changed_data:
|
||||||
|
Loading…
Reference in New Issue
Block a user