mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
* Add CustomLogEntry model support and update tests: - Added support for CustomLogEntry data model to extend django-auditlog capabilities - Updated existing test cases to align with new model structure and data handling logic - Added new test cases to validate CustomLogEntry behavior, model registration, and signal handling - Ensured backward compatibility with existing LogEntry model where applicable * Update auditlog/__init__.py Co-authored-by: Youngkwang Yang <me@youngkwang.dev> * run only one custom model test matrix (#761) --------- Co-authored-by: Youngkwang Yang <me@youngkwang.dev>
25 lines
756 B
Python
25 lines
756 B
Python
from __future__ import annotations
|
|
|
|
from importlib.metadata import version
|
|
|
|
from django.apps import apps as django_apps
|
|
from django.conf import settings
|
|
from django.core.exceptions import ImproperlyConfigured
|
|
|
|
__version__ = version("django-auditlog")
|
|
|
|
|
|
def get_logentry_model():
|
|
try:
|
|
return django_apps.get_model(
|
|
settings.AUDITLOG_LOGENTRY_MODEL, require_ready=False
|
|
)
|
|
except ValueError:
|
|
raise ImproperlyConfigured(
|
|
"AUDITLOG_LOGENTRY_MODEL must be of the form 'app_label.model_name'"
|
|
)
|
|
except LookupError:
|
|
raise ImproperlyConfigured(
|
|
"AUDITLOG_LOGENTRY_MODEL refers to model '%s' that has not been installed"
|
|
% settings.AUDITLOG_LOGENTRY_MODEL
|
|
)
|