Renamed CreatedUpdatedModel to ChangeLoggedModel and applied it to all primary and organizational models

This commit is contained in:
Jeremy Stretch
2018-06-13 15:40:16 -04:00
parent 60a84af1b3
commit a8329687da
14 changed files with 503 additions and 106 deletions

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-06-13 17:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tenancy', '0004_tags'),
]
operations = [
migrations.AddField(
model_name='tenantgroup',
name='created',
field=models.DateField(auto_now_add=True, null=True),
),
migrations.AddField(
model_name='tenantgroup',
name='last_updated',
field=models.DateTimeField(auto_now=True, null=True),
),
migrations.AlterField(
model_name='tenant',
name='created',
field=models.DateField(auto_now_add=True, null=True),
),
migrations.AlterField(
model_name='tenant',
name='last_updated',
field=models.DateTimeField(auto_now=True, null=True),
),
]

View File

@@ -7,11 +7,11 @@ from django.utils.encoding import python_2_unicode_compatible
from taggit.managers import TaggableManager
from extras.models import CustomFieldModel
from utilities.models import CreatedUpdatedModel
from utilities.models import ChangeLoggedModel
@python_2_unicode_compatible
class TenantGroup(models.Model):
class TenantGroup(ChangeLoggedModel):
"""
An arbitrary collection of Tenants.
"""
@@ -23,9 +23,8 @@ class TenantGroup(models.Model):
unique=True
)
csv_headers = ['name', 'slug']
serializer = 'tenancy.api.serializers.TenantGroupSerializer'
csv_headers = ['name', 'slug']
class Meta:
ordering = ['name']
@@ -44,7 +43,7 @@ class TenantGroup(models.Model):
@python_2_unicode_compatible
class Tenant(CreatedUpdatedModel, CustomFieldModel):
class Tenant(ChangeLoggedModel, CustomFieldModel):
"""
A Tenant represents an organization served by the NetBox owner. This is typically a customer or an internal
department.
@@ -79,9 +78,8 @@ class Tenant(CreatedUpdatedModel, CustomFieldModel):
tags = TaggableManager()
csv_headers = ['name', 'slug', 'group', 'description', 'comments']
serializer = 'tenancy.api.serializers.TenantSerializer'
csv_headers = ['name', 'slug', 'group', 'description', 'comments']
class Meta:
ordering = ['group', 'name']