1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

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 81258ea35b
commit b556d2d626
14 changed files with 503 additions and 106 deletions

View File

@@ -3,9 +3,21 @@ from __future__ import unicode_literals
from django.db import models
class CreatedUpdatedModel(models.Model):
created = models.DateField(auto_now_add=True)
last_updated = models.DateTimeField(auto_now=True)
class ChangeLoggedModel(models.Model):
"""
An abstract model which adds fields to store the creation and last-updated times for an object. Both fields can be
null to facilitate adding these fields to existing instances via a database migration.
"""
created = models.DateField(
auto_now_add=True,
blank=True,
null=True
)
last_updated = models.DateTimeField(
auto_now=True,
blank=True,
null=True
)
class Meta:
abstract = True