Skip to content

Commit 88f9feb

Browse files
committed
Fixes #388: Fix deletion of M2M assignments created within a branch
1 parent bef7188 commit 88f9feb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

netbox_branching/signal_receivers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from utilities.exceptions import AbortRequest
1919
from utilities.serialization import serialize_object
2020
from .choices import BranchStatusChoices
21+
from .constants import INCLUDE_MODELS
2122
from .contextvars import active_branch
2223
from .events import *
2324
from .models import Branch, ChangeDiff
@@ -48,6 +49,12 @@ def check_object_accessible_in_branch(branch, model, object_id):
4849
Returns:
4950
True if the object is accessible (exists in main or was created in branch), False otherwise
5051
"""
52+
# Exempt models listed in INCLUDE_MODELS. These are replicated when a new branch is provisioned but are not
53+
# managed directly.
54+
if f'{model._meta.app_label}.{model._meta.model_name}' in INCLUDE_MODELS:
55+
return True
56+
57+
# Check whether the object exists in main
5158
with deactivate_branch():
5259
try:
5360
model.objects.get(pk=object_id)

0 commit comments

Comments
 (0)