Signed-off-by: Fam Zheng <famz@redhat.com>
---
api/models.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/api/models.py b/api/models.py
index ebaecde..ad89cf8 100644
--- a/api/models.py
+++ b/api/models.py
@@ -78,7 +78,11 @@ class Result(models.Model):
def save(self):
self.last_update = datetime.datetime.utcnow()
- return super(Result, self).save()
+ old_result = Result.objects.filter(pk=self.pk).first()
+ old_status = old_result.status if old_result else None
+ r = super(Result, self).save()
+ emit_event("ResultUpdate", obj=self.obj,
+ old_status=old_status, result=self)
@property
def renderer(self):
@@ -300,6 +304,10 @@ declare_event("SetProperty", obj="object to set the property",
value="value of the property",
old_value="old value if any")
+declare_event("ResultUpdate", obj="the updated object",
+ old_status='the old result status',
+ result="the new result object")
+
class MessageManager(models.Manager):
class DuplicateMessageError(Exception):
--
2.17.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel