infrasynth-backend-kit/infrasynth/audit/mixins.py
2026-08-28 14:38:47 -05:00

26 lines
752 B
Python

from django.conf import settings
from django.db import models
class OptionalAuditableMixin(models.Model):
"""Mixin for models that want explicit auditable fields."""
usuario_creacion = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="+",
)
fecha_creacion = models.DateTimeField(auto_now_add=True, null=True, blank=True)
usuario_actualizacion = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="+",
)
fecha_actualizacion = models.DateTimeField(auto_now=True, null=True, blank=True)
class Meta:
abstract = True