Skip to content

Commit bc597c3

Browse files
committed
Closes #17472: Deprecate the staged changes API
1 parent ed1327e commit bc597c3

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

docs/models/extras/branch.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Branches
22

3+
!!! danger "Deprecated Feature"
4+
This feature has been deprecated in NetBox v4.2 and will be removed in a future release. Please consider using the [netbox-branching plugin](https://github.com/netboxlabs/netbox-branching), which provides much more robust functionality.
5+
36
A branch is a collection of related [staged changes](./stagedchange.md) that have been prepared for merging into the active database. A branch can be merged by executing its `commit()` method. Deleting a branch will delete all its related changes.
47

58
## Fields

docs/models/extras/stagedchange.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Staged Changes
22

3+
!!! danger "Deprecated Feature"
4+
This feature has been deprecated in NetBox v4.2 and will be removed in a future release. Please consider using the [netbox-branching plugin](https://github.com/netboxlabs/netbox-branching), which provides much more robust functionality.
5+
36
A staged change represents the creation of a new object or the modification or deletion of an existing object to be performed at some future point. Each change must be assigned to a [branch](./branch.md).
47

58
Changes can be applied individually via the `apply()` method, however it is recommended to apply changes in bulk using the parent branch's `commit()` method.

docs/plugins/development/staged-changes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Staged Changes
22

3-
!!! danger "Experimental Feature"
4-
This feature is still under active development and considered experimental in nature. Its use in production is strongly discouraged at this time.
3+
!!! danger "Deprecated Feature"
4+
This feature has been deprecated in NetBox v4.2 and will be removed in a future release. Please consider using the [netbox-branching plugin](https://github.com/netboxlabs/netbox-branching), which provides much more robust functionality.
55

66
NetBox provides a programmatic API to stage the creation, modification, and deletion of objects without actually committing those changes to the active database. This can be useful for performing a "dry run" of bulk operations, or preparing a set of changes for administrative approval, for example.
77

netbox/extras/models/staging.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import warnings
23

34
from django.contrib.contenttypes.fields import GenericForeignKey
45
from django.db import models, transaction
@@ -44,6 +45,13 @@ class Meta:
4445
verbose_name = _('branch')
4546
verbose_name_plural = _('branches')
4647

48+
def __init__(self, *args, **kwargs):
49+
warnings.warn(
50+
'The staged changes functionality has been deprecated and will be removed in a future release.',
51+
DeprecationWarning
52+
)
53+
super().__init__(*args, **kwargs)
54+
4755
def __str__(self):
4856
return f'{self.name} ({self.pk})'
4957

@@ -97,6 +105,13 @@ class Meta:
97105
verbose_name = _('staged change')
98106
verbose_name_plural = _('staged changes')
99107

108+
def __init__(self, *args, **kwargs):
109+
warnings.warn(
110+
'The staged changes functionality has been deprecated and will be removed in a future release.',
111+
DeprecationWarning
112+
)
113+
super().__init__(*args, **kwargs)
114+
100115
def __str__(self):
101116
action = self.get_action_display()
102117
app_label, model_name = self.object_type.natural_key()

0 commit comments

Comments
 (0)