mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fix up some bugs with signal handling related to association/disassociation
This commit is contained in:
@@ -18,11 +18,11 @@ class ActivityStream(models.Model):
|
|||||||
('update', _("Entity Updated")),
|
('update', _("Entity Updated")),
|
||||||
('delete', _("Entity Deleted")),
|
('delete', _("Entity Deleted")),
|
||||||
('associate', _("Entity Associated with another Entity")),
|
('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')
|
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)
|
timestamp = models.DateTimeField(auto_now_add=True)
|
||||||
changes = models.TextField(blank=True)
|
changes = models.TextField(blank=True)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# Python
|
# Python
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
import json
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.db.models.signals import pre_save, post_save, pre_delete, post_delete, m2m_changed
|
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
|
obj1_id = obj1.id
|
||||||
obj_rel = str(sender)
|
obj_rel = str(sender)
|
||||||
for entity_acted in kwargs['pk_set']:
|
for entity_acted in kwargs['pk_set']:
|
||||||
obj2 = entity_acted
|
obj2 = kwargs['model']
|
||||||
obj2_id = entity_acted.id
|
obj2_id = entity_acted
|
||||||
activity_entry = ActivityStream(
|
activity_entry = ActivityStream(
|
||||||
operation=action,
|
operation=action,
|
||||||
object1_id=obj1_id,
|
object1_id=obj1_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user