Closes #4840: Enable change logging for config contexts

This commit is contained in:
Jeremy Stretch
2020-07-09 17:09:03 -04:00
parent 19c7c2ddcc
commit d5c096746b
7 changed files with 39 additions and 3 deletions

View File

@@ -233,7 +233,7 @@ class ConfigContextSerializer(ValidatedModelSerializer):
model = ConfigContext
fields = [
'id', 'url', 'name', 'weight', 'description', 'is_active', 'regions', 'sites', 'roles', 'platforms',
'cluster_groups', 'clusters', 'tenant_groups', 'tenants', 'tags', 'data',
'cluster_groups', 'clusters', 'tenant_groups', 'tenants', 'tags', 'data', 'created', 'last_updated',
]

View File

@@ -0,0 +1,23 @@
# Generated by Django 3.0.6 on 2020-07-09 20:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0044_jobresult'),
]
operations = [
migrations.AddField(
model_name='configcontext',
name='created',
field=models.DateField(auto_now_add=True, null=True),
),
migrations.AddField(
model_name='configcontext',
name='last_updated',
field=models.DateTimeField(auto_now=True, null=True),
),
]

View File

@@ -434,7 +434,7 @@ class ImageAttachment(models.Model):
# Config contexts
#
class ConfigContext(models.Model):
class ConfigContext(ChangeLoggedModel):
"""
A ConfigContext represents a set of arbitrary data available to any Device or VirtualMachine matching its assigned
qualifiers (region, site, etc.). For example, the data stored in a ConfigContext assigned to site A and tenant B

View File

@@ -45,6 +45,7 @@ class TagTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
# Blocked by absence of standard create/edit, bulk create views
class ConfigContextTestCase(
ViewTestCases.GetObjectViewTestCase,
ViewTestCases.GetObjectChangelogViewTestCase,
ViewTestCases.DeleteObjectViewTestCase,
ViewTestCases.ListObjectsViewTestCase,
ViewTestCases.BulkEditObjectsViewTestCase,

View File

@@ -1,7 +1,7 @@
from django.urls import path
from extras import views
from extras.models import Tag
from extras.models import ConfigContext, Tag
app_name = 'extras'
@@ -25,6 +25,7 @@ urlpatterns = [
path('config-contexts/<int:pk>/', views.ConfigContextView.as_view(), name='configcontext'),
path('config-contexts/<int:pk>/edit/', views.ConfigContextEditView.as_view(), name='configcontext_edit'),
path('config-contexts/<int:pk>/delete/', views.ConfigContextDeleteView.as_view(), name='configcontext_delete'),
path('config-contexts/<int:pk>/changelog/', views.ObjectChangeLogView.as_view(), name='configcontext_changelog', kwargs={'model': ConfigContext}),
# Image attachments
path('image-attachments/<int:pk>/edit/', views.ImageAttachmentEditView.as_view(), name='imageattachment_edit'),