Explorar o código

Fixes #14056: Record a pre-change snapshot when bulk editing objects via CSV

Jeremy Stretch %!s(int64=2) %!d(string=hai) anos
pai
achega
82591ad8a1
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      netbox/netbox/views/generic/bulk_views.py

+ 4 - 0
netbox/netbox/views/generic/bulk_views.py

@@ -394,6 +394,10 @@ class BulkImportView(GetReturnURLMixin, BaseMultiObjectView):
                     form.add_error('data', f"Row {i}: Object with ID {object_id} does not exist")
                     raise ValidationError('')
 
+                # Take a snapshot for change logging
+                if instance.pk and hasattr(instance, 'snapshot'):
+                    instance.snapshot()
+
             # Instantiate the model form for the object
             model_form_kwargs = {
                 'data': record,