feat(config_management): History Model for Config Group Hosts added
ref: #605 #637
This commit is contained in:
@ -1 +1,2 @@
|
||||
from .config_groups_history import ConfigGroupsHistory # pylint: disable=W0611:unused-import
|
||||
from .config_groups_hosts_history import ConfigGroupHostsHistory # pylint: disable=W0611:unused-import
|
||||
|
54
app/config_management/models/config_groups_hosts_history.py
Normal file
54
app/config_management/models/config_groups_hosts_history.py
Normal file
@ -0,0 +1,54 @@
|
||||
from django.db import models
|
||||
|
||||
from core.models.model_history import ModelHistory
|
||||
|
||||
from config_management.models.config_groups_history import ConfigGroupsHistory
|
||||
from config_management.models.groups import ConfigGroupHosts
|
||||
|
||||
|
||||
|
||||
class ConfigGroupHostsHistory(
|
||||
ConfigGroupsHistory
|
||||
):
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
db_table = 'config_management_configgrouphosts_history'
|
||||
|
||||
ordering = ModelHistory._meta.ordering
|
||||
|
||||
verbose_name = 'Config Group Hosts History'
|
||||
|
||||
verbose_name_plural = 'Config Groups Hosts History'
|
||||
|
||||
|
||||
child_model = models.ForeignKey(
|
||||
ConfigGroupHosts,
|
||||
blank = False,
|
||||
help_text = 'Model this note belongs to',
|
||||
null = False,
|
||||
on_delete = models.CASCADE,
|
||||
related_name = 'history',
|
||||
verbose_name = 'Model',
|
||||
)
|
||||
|
||||
table_fields: list = []
|
||||
|
||||
page_layout: dict = []
|
||||
|
||||
|
||||
def get_object(self):
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def get_serialized_model(self, serializer_context):
|
||||
|
||||
model = None
|
||||
|
||||
from itam.serializers.device import DeviceBaseSerializer
|
||||
|
||||
model = DeviceBaseSerializer(self.child_model.host, context = serializer_context)
|
||||
|
||||
return model
|
Reference in New Issue
Block a user