diff --git a/netbox/netbox/staging.py b/netbox/netbox/staging.py index 11a35d427..c18bd86ce 100644 --- a/netbox/netbox/staging.py +++ b/netbox/netbox/staging.py @@ -143,12 +143,6 @@ class checkout: key = self.get_key_for_instance(instance) object_type = instance._meta.verbose_name - # Cancel the creation of a new object - if key in self.queue and self.queue[key][0] == ChangeActionChoices.ACTION_CREATE: - logger.debug(f"[{self.branch}] Removing staged creation of {object_type} {instance} (PK: {instance.pk})") - del self.queue[key] - return - # Delete an existing object logger.debug(f"[{self.branch}] Staging deletion of {object_type} {instance} (PK: {instance.pk})") self.queue[key] = (ChangeActionChoices.ACTION_DELETE, None) diff --git a/netbox/netbox/tests/test_staging.py b/netbox/netbox/tests/test_staging.py index 44f9d9a32..8ef76e649 100644 --- a/netbox/netbox/tests/test_staging.py +++ b/netbox/netbox/tests/test_staging.py @@ -168,25 +168,6 @@ class StagingTestCase(TransactionTestCase): self.assertEqual(Circuit.objects.count(), 6) self.assertEqual(Change.objects.count(), 0) - def test_create_update_delete_clean(self): - branch = Branch.objects.create(name='Branch 1') - - with checkout(branch): - - # Create a new object - provider = Provider.objects.create(name='Provider D', slug='provider-d') - provider.save() - - # Update it - provider.comments = 'Another change' - provider.save() - - # Delete it - provider.delete() - - # Check that the staged Change has been deleted - self.assertFalse(Change.objects.exists()) - def test_exit_enter_context(self): branch = Branch.objects.create(name='Branch 1')