mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Changed import to use the new apps module for get_model, this removes
the Django warning: site-packages/auditlog/middleware.py:9: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system. from django.db.models.loading import get_model
This commit is contained in:
parent
59fc9eff18
commit
655e02e806
1 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ import time
|
|||
from django.conf import settings
|
||||
from django.db.models.signals import pre_save
|
||||
from django.utils.functional import curry
|
||||
from django.db.models.loading import get_model
|
||||
from django.apps import apps
|
||||
from auditlog.models import LogEntry
|
||||
|
||||
|
||||
|
|
@ -65,9 +65,9 @@ class AuditlogMiddleware(object):
|
|||
"""
|
||||
try:
|
||||
app_label, model_name = settings.AUTH_USER_MODEL.split('.')
|
||||
auth_user_model = get_model(app_label, model_name)
|
||||
auth_user_model = apps.get_model(app_label, model_name)
|
||||
except ValueError:
|
||||
auth_user_model = get_model('auth', 'user')
|
||||
auth_user_model = apps.get_model('auth', 'user')
|
||||
if sender == LogEntry and isinstance(user, auth_user_model) and instance.actor is None:
|
||||
instance.actor = user
|
||||
if hasattr(threadlocal, 'auditlog'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue