don't throw composite key error if the only fields updated are in [backend_status, backend_register, deleted, enacted, updated]
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 377bf19..238e6f0 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -219,7 +219,18 @@
if "silent" in kwargs:
silent=silent or kwargs.pop("silent")
- self.check_composite_primary_key()
+ # SMBAKER: if an object is trying to delete itself, or if the observer
+ # is updating an object's backend_* fields, then let it slip past the
+ # composite key check.
+ ignore_composite_key_check=False
+ if "update_fields" in kwargs:
+ ignore_composite_key_check=True
+ for field in kwargs["update_fields"]:
+ if not (field in ["backend_register", "backend_status", "deleted", "enacted", "updated"]):
+ ignore_composite_key_check=False
+
+ if not ignore_composite_key_check:
+ self.check_composite_primary_key()
super(PlCoreBase, self).save(*args, **kwargs)