from django.db import models from auditlog.models import AuditLogHistoryField from auditlog.registry import auditlog class SimpleModel(models.Model): """ A simple model with no special things going on. """ text = models.TextField(blank=True) boolean = models.BooleanField(default=False) integer = models.IntegerField(blank=True, null=True) datetime = models.DateTimeField(auto_now=True) history = AuditLogHistoryField() class AltPrimaryKeyModel(models.Model): """ A model with a non-standard primary key. """ key = models.CharField(max_length=100, primary_key=True) value = models.DecimalField(decimal_places=4, max_digits=12) history = AuditLogHistoryField() class ProxyModel(SimpleModel): """ A model that is a proxy for another model. """ class Meta: proxy = True class RelatedModel(models.Model): """ A model with a foreign key. """ related = models.ForeignKey('self') history = AuditLogHistoryField() class ManyRelatedModel(models.Model): """ A model with a many to many relation. """ related = models.ManyToManyField('self') history = AuditLogHistoryField() auditlog.register(SimpleModel)