From f1de300fd707dc7ab995f389dd691c649505a805 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 8 Nov 2013 13:08:48 -0500 Subject: [PATCH] Fix up some bugs with signal handling related to association/disassociation --- awx/main/models/activity_stream.py | 4 ++-- awx/main/signals.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/awx/main/models/activity_stream.py b/awx/main/models/activity_stream.py index 5d4440a7e7..42b415baa4 100644 --- a/awx/main/models/activity_stream.py +++ b/awx/main/models/activity_stream.py @@ -18,11 +18,11 @@ class ActivityStream(models.Model): ('update', _("Entity Updated")), ('delete', _("Entity Deleted")), ('associate', _("Entity Associated with another Entity")), - ('disaassociate', _("Entity was Disassociated with another Entity")) + ('disassociate', _("Entity was Disassociated with another Entity")) ] user = models.ForeignKey('auth.User', null=True, on_delete=models.SET_NULL, related_name='activity_stream') - operation = models.CharField(max_length=9, choices=OPERATION_CHOICES) + operation = models.CharField(max_length=13, choices=OPERATION_CHOICES) timestamp = models.DateTimeField(auto_now_add=True) changes = models.TextField(blank=True) diff --git a/awx/main/signals.py b/awx/main/signals.py index 06abd69d81..5a6ae810c3 100644 --- a/awx/main/signals.py +++ b/awx/main/signals.py @@ -4,6 +4,7 @@ # Python import logging import threading +import json # Django from django.db.models.signals import pre_save, post_save, pre_delete, post_delete, m2m_changed @@ -215,8 +216,8 @@ def activity_stream_associate(sender, instance, **kwargs): obj1_id = obj1.id obj_rel = str(sender) for entity_acted in kwargs['pk_set']: - obj2 = entity_acted - obj2_id = entity_acted.id + obj2 = kwargs['model'] + obj2_id = entity_acted activity_entry = ActivityStream( operation=action, object1_id=obj1_id,