mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Move ActivityStream to it's own model file
This commit is contained in:
parent
5986a48036
commit
5989250471
@ -2,7 +2,7 @@ from django.conf import settings
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db.models.signals import pre_save
|
from django.db.models.signals import pre_save
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from awx.main.models.base import ActivityStream
|
from awx.main.models.activity_stream import ActivityStream
|
||||||
|
|
||||||
|
|
||||||
class ActivityStreamMiddleware(object):
|
class ActivityStreamMiddleware(object):
|
||||||
|
@ -6,6 +6,7 @@ from awx.main.models.organization import *
|
|||||||
from awx.main.models.projects import *
|
from awx.main.models.projects import *
|
||||||
from awx.main.models.inventory import *
|
from awx.main.models.inventory import *
|
||||||
from awx.main.models.jobs import *
|
from awx.main.models.jobs import *
|
||||||
|
from awx.main.models.activity_stream import *
|
||||||
from awx.main.registrar import activity_stream_registrar
|
from awx.main.registrar import activity_stream_registrar
|
||||||
|
|
||||||
# Monkeypatch Django serializer to ignore django-taggit fields (which break
|
# Monkeypatch Django serializer to ignore django-taggit fields (which break
|
||||||
|
30
awx/main/models/activity_stream.py
Normal file
30
awx/main/models/activity_stream.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright (c) 2013 AnsibleWorks, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class ActivityStream(models.Model):
|
||||||
|
'''
|
||||||
|
Model used to describe activity stream (audit) events
|
||||||
|
'''
|
||||||
|
OPERATION_CHOICES = [
|
||||||
|
('create', _('Entity Created')),
|
||||||
|
('update', _("Entity Updated")),
|
||||||
|
('delete', _("Entity Deleted")),
|
||||||
|
('associate', _("Entity Associated with another Entity")),
|
||||||
|
('disaassociate', _("Entity was Disassociated with another Entity"))
|
||||||
|
]
|
||||||
|
|
||||||
|
user = models.ForeignKey('auth.User', null=True, on_delete=models.SET_NULL)
|
||||||
|
operation = models.CharField(max_length=9, choices=OPERATION_CHOICES)
|
||||||
|
timestamp = models.DateTimeField(auto_now_add=True)
|
||||||
|
changes = models.TextField(blank=True)
|
||||||
|
|
||||||
|
object1_id = models.PositiveIntegerField(db_index=True)
|
||||||
|
object1_type = models.TextField()
|
||||||
|
|
||||||
|
object2_id = models.PositiveIntegerField(db_index=True)
|
||||||
|
object2_type = models.TextField()
|
||||||
|
|
||||||
|
object_relationship_type = models.TextField()
|
@ -22,7 +22,7 @@ from taggit.managers import TaggableManager
|
|||||||
# Django-Celery
|
# Django-Celery
|
||||||
from djcelery.models import TaskMeta
|
from djcelery.models import TaskMeta
|
||||||
|
|
||||||
__all__ = ['VarsDictProperty', 'PrimordialModel', 'CommonModel', 'ActivityStream',
|
__all__ = ['VarsDictProperty', 'PrimordialModel', 'CommonModel',
|
||||||
'CommonModelNameNotUnique', 'CommonTask', 'PERM_INVENTORY_ADMIN',
|
'CommonModelNameNotUnique', 'CommonTask', 'PERM_INVENTORY_ADMIN',
|
||||||
'PERM_INVENTORY_READ', 'PERM_INVENTORY_WRITE',
|
'PERM_INVENTORY_READ', 'PERM_INVENTORY_WRITE',
|
||||||
'PERM_INVENTORY_DEPLOY', 'PERM_INVENTORY_CHECK', 'JOB_TYPE_CHOICES',
|
'PERM_INVENTORY_DEPLOY', 'PERM_INVENTORY_CHECK', 'JOB_TYPE_CHOICES',
|
||||||
|
Loading…
Reference in New Issue
Block a user