Skip to content

Fixes #69: Represent null values for ChangeDiff fields consistently in REST API #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions netbox_branching/signal_receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def record_change_diff(instance, **kwargs):
branch__status=BranchStatusChoices.READY
).update(
last_updated=timezone.now(),
current=instance.postchange_data_clean
current=instance.postchange_data_clean or None
)

# If this is a branch-aware change, create or update ChangeDiff for this object.
Expand All @@ -65,7 +65,7 @@ def record_change_diff(instance, **kwargs):
diff.last_updated = timezone.now()
if diff.action != ObjectChangeActionChoices.ACTION_CREATE:
diff.action = instance.action
diff.modified = instance.postchange_data_clean
diff.modified = instance.postchange_data_clean or None
diff.save()

# Creating a new ChangeDiff
Expand All @@ -81,9 +81,9 @@ def record_change_diff(instance, **kwargs):
branch=branch,
object=instance.changed_object,
action=instance.action,
original=instance.prechange_data_clean,
modified=instance.postchange_data_clean,
current=current_data,
original=instance.prechange_data_clean or None,
modified=instance.postchange_data_clean or None,
current=current_data or None,
last_updated=timezone.now(),
)
diff.save()
Expand Down