New version of delete, which marks as delete instead of removing an
object.
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 2f7fd82..fc8e740 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -72,20 +72,17 @@
def delete(self, *args, **kwds):
# so we have something to give the observer
- pk = self.pk
- model_dict = model_to_dict(self)
- for (k,v) in model_dict.items():
- # things like datetime are not JSON serializable
- model_dict[k] = str(v)
+ if (observer_disabled):
+ super(PlCoreBase, self).delete(*args, **kwargs)
+ else:
+ self.deleted = True
+ self.enacted=None
+ self.save(update_fields=['enacted','deleted'])
- super(PlCoreBase, self).delete(*args, **kwds)
-
- # This is a no-op if observer_disabled is set
- notify_observer(model=self, delete=True, pk=pk, model_dict=model_dict)
def save(self, *args, **kwargs):
super(PlCoreBase, self).save(*args, **kwargs)
-
+
# This is a no-op if observer_disabled is set
notify_observer()
diff --git a/planetstack/observer/syncstep.py b/planetstack/observer/syncstep.py
index 739e598..f7bcffb 100644
--- a/planetstack/observer/syncstep.py
+++ b/planetstack/observer/syncstep.py
@@ -62,7 +62,7 @@
self.check_dependencies(o,f) # Raises exception if failed
self.sync_record(o)
o.enacted = datetime.now() # Is this the same timezone? XXX
- o.backend_status = "OK")
+ o.backend_status = "OK"
o.save(update_fields=['enacted'])
except Exception,e:
try: