mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 16:28:43 -03:30
Merge pull request #2711 from YunfanZhang42/add_instance_groups_to_activity_stream
Add instance groups to activity stream.
This commit is contained in:
20
awx/main/migrations/0047_v330_activitystream_instance.py
Normal file
20
awx/main/migrations/0047_v330_activitystream_instance.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.11 on 2018-07-25 20:19
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0046_v330_remove_client_credentials_grant'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='activitystream',
|
||||||
|
name='instance',
|
||||||
|
field=models.ManyToManyField(blank=True, to='main.Instance'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -66,6 +66,7 @@ class ActivityStream(models.Model):
|
|||||||
notification = models.ManyToManyField("Notification", blank=True)
|
notification = models.ManyToManyField("Notification", blank=True)
|
||||||
label = models.ManyToManyField("Label", blank=True)
|
label = models.ManyToManyField("Label", blank=True)
|
||||||
role = models.ManyToManyField("Role", blank=True)
|
role = models.ManyToManyField("Role", blank=True)
|
||||||
|
instance = models.ManyToManyField("Instance", blank=True)
|
||||||
instance_group = models.ManyToManyField("InstanceGroup", blank=True)
|
instance_group = models.ManyToManyField("InstanceGroup", blank=True)
|
||||||
o_auth2_application = models.ManyToManyField("OAuth2Application", blank=True)
|
o_auth2_application = models.ManyToManyField("OAuth2Application", blank=True)
|
||||||
o_auth2_access_token = models.ManyToManyField("OAuth2AccessToken", blank=True)
|
o_auth2_access_token = models.ManyToManyField("OAuth2AccessToken", blank=True)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import sys
|
|||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models.signals import (
|
from django.db.models.signals import (
|
||||||
|
pre_save,
|
||||||
post_save,
|
post_save,
|
||||||
pre_delete,
|
pre_delete,
|
||||||
post_delete,
|
post_delete,
|
||||||
@@ -389,6 +390,7 @@ model_serializer_mapping = {
|
|||||||
Inventory: InventorySerializer,
|
Inventory: InventorySerializer,
|
||||||
Host: HostSerializer,
|
Host: HostSerializer,
|
||||||
Group: GroupSerializer,
|
Group: GroupSerializer,
|
||||||
|
InstanceGroup: InstanceGroupSerializer,
|
||||||
InventorySource: InventorySourceSerializer,
|
InventorySource: InventorySourceSerializer,
|
||||||
CustomInventoryScript: CustomInventoryScriptSerializer,
|
CustomInventoryScript: CustomInventoryScriptSerializer,
|
||||||
Credential: CredentialSerializer,
|
Credential: CredentialSerializer,
|
||||||
@@ -641,3 +643,7 @@ def create_access_token_user_if_missing(sender, **kwargs):
|
|||||||
post_save.connect(create_access_token_user_if_missing, sender=OAuth2AccessToken)
|
post_save.connect(create_access_token_user_if_missing, sender=OAuth2AccessToken)
|
||||||
|
|
||||||
|
|
||||||
|
# Connect the Instance Group to Activity Stream receivers.
|
||||||
|
post_save.connect(activity_stream_create, sender=InstanceGroup, dispatch_uid=str(InstanceGroup) + "_create")
|
||||||
|
pre_save.connect(activity_stream_update, sender=InstanceGroup, dispatch_uid=str(InstanceGroup) + "_update")
|
||||||
|
pre_delete.connect(activity_stream_delete, sender=InstanceGroup, dispatch_uid=str(InstanceGroup) + "_delete")
|
||||||
|
|||||||
Reference in New Issue
Block a user