mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Fix up some bugs with signal handling related to association/disassociation
This commit is contained in:
parent
49a2502043
commit
f1de300fd7
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user